delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/07/18/11:29:52

X-Spam-Check-By: sourceware.org
Message-ID: <469E31D4.4733053E@dessent.net>
Date: Wed, 18 Jul 2007 08:29:24 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Own Compiled Program Immediately Crashes on Startup
References: <20070718100058 DOT 203680 AT gmx DOT net> <20070718105312 DOT 83940 AT gmx DOT net> <026a01c7c932$4cae0810$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20070718121556 DOT 83920 AT gmx DOT net> <026e01c7c936$bad581c0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20070718133420 DOT 83920 AT gmx DOT net> <027901c7c941$c6e51e70$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20070718140257 DOT 83920 AT gmx DOT net> <027e01c7c947$31c0d310$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <469E25B2 DOT 3A0A359A AT dessent DOT net> <20070718150917 DOT 83910 AT gmx DOT net>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hans Streibel wrote:

> Sorry I can't do that very quickly because I have
> no idea what you are talking about :-(
> - .rodata
> - .data
> - linker script,
> - strategic un-consting of the offending symbols

Sorry, it's actually .rdata not .rodata, and I typed a very abbreviated
message in hopes that it would be enough to google on.  The problem
occurs when you have a data structure (typically a struct) declared
const that contains any reference to a variable that is imported from
another DLL.  A fuller explanation is
<http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html>.

As you can see from Chuck's message it's kind of a hairy situation in
that there is no "real" fix for it other than undoing the optimization
of placing these in a readonly section.  That can be accomplished by
either using a modified linker script or by removing the 'const' from
the declaration.  The former is a sort of brute force/last ditch
approach which is useful if you have a very large code base with lots of
modules and you can't or don't want to hunt down the offending structs. 
I think the qt project had to take this approach:
<http://www.cygwin.com/ml/cygwin/2004-10/msg01052.html>

I'm not convinced this is what's wrong in your case, but it fits the
symptoms so it's worth ruling out.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019