This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Own Compiled Program Immediately Crashes on Startup


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]