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]

SOLUTION: Own Compiled Program Immediately Crashes on Startup

On Wed, Jul 18, 2007 at 08:29:24AM -0700, Brian Dessent wrote:
> 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
> <>.
> 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:
> <>
> I'm not convinced this is what's wrong in your case, but it fits the
> symptoms so it's worth ruling out.

Hello Brian,

that's it! Thanks a lot for your hint.

I was wrong with my assumption that it was only K&R C code.
Obviously someone is maintaining the code - and put "const" modifiers
into the code.

I followed that brute force method with the modified linker
script - and succeeded.

For all of you who might have the same problem in future, I
include that linker script in the attachment. Store it under:
And use these options for linking (use gcc!):

One big problem remains. Maybe I should better start a new thread for
this but maybe someone has a quick answer for me here...

Jove is an Emacs like editor. As such it uses the key sequence
CONTROL-X CONTROL-C (^X^C) for leaving the editor.
In Cygwin however ^C still sends the interrupt signal to the editor.
However the keystroke ^C should have been changed to not sending
that signal. On most platforms that works - but not in Cygwin.

I can't tell right now what mechanism Jove is using for handling
the terminal under Cygwin. There so many mechanisms:
"struct termio", "struct termios", "struct sgttyb".
Jove under Cygwin follows BSD POSIX.

Does anyone have an idea on how that interrupt signal can
be switched off for ^C? Jove's code seems to be ok here because
I already compiled that code on several platforms.
A bug in Cygwin? What should be used in Cygwin:
- struct termio
- struct termios
- struct sgttyb

Interesting to know:
I just installed "screen" and Jove's exit command (^X^C) is working
fine under screen. So what is different?


Attachment: i386pe.x-no-rdata
Description: Text document

Unsubscribe info:
Problem reports:

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