Own Compiled Program Immediately Crashes on Startup

Dave Korn dave.korn@artimi.com
Wed Jul 18 13:44:00 GMT 2007

On 18 July 2007 14:34, Hans Streibel wrote:

>>> How can this link order be changed so that the cygwin dll
>>> is linked in first?
>> Well, for a start, you'd need to link against the cygwin dll directly,
>> and it would need to be first on the linker command line.
> How can I link to a dll directly? It is a dynamic library so
> as far as I know there is nothing the linker could do here.

  You specify "-l<libname>", and the compiler and linker find the import stub
library (.dll.a) for you.  That's all I meant by the phrase. 

>> It could also be a problem with the link stage.  Make sure the
>> makefile is using 'gcc' to link the application and not trying to invoke
>> 'ld' directly.
> It is using gcc to link the application. See the attachment.

  Yes, so I see; everything looks correct in that linker commandline.

>> One thing, though, by "*my* cygwin Makefile", do you mean the project
>> doesn't come with its own makefile and you had to put one together
>> yourself?
> The package does not come with a makefile for cygwin.
> But there is a README for cygwin and there is a generic Unix
> makefile with lots of comments on what to change for cygwin.
> Thus I copied that Unix makefile and made the necessary
> adjustments in within the copy.
>> Or is it just the one that the project came with or autogenerated using
>> configure or some similar script?
> It is an old package. No "configure". You have to do necessary
> adjustments directly in the makefile.

  Heh, how quaint!

  Anyway, I guess the next thing to try is invoke the executable under gdb and
see if that shows you any more useful information about where it's gotten to
when it crashes.

Can't think of a witty .sigline today....

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/

More information about the Cygwin mailing list