This is the mail archive of the cygwin@sources.redhat.com 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]

Re: crash using _environ from libmsvcrt20/40.a


> > MSVCRT*.DLL and Cygwin1.dll are mutually exclusive.  You can't mix them.
> >
> > If you want to use MSVCRT*.DLL use the -mno-cygwin option when you compile
> > and link.
> 
> Thanks, I've added that, and objdump -p confirms that the binary does
> not use cygwin.dll, BUT the program still faults in the same way.

For the benefit of anyone who's interested, and didn't already know:

extern __declspec(dllimport) char **_environ;

is what was needed.
I had tried using the msvc++ header for _environ(stdlib.h), but it
doesn't use
declspec, and I couldn't find any cygwin header that had _environ in it.

The object code generated for accessing _environ now has an extra layer
of
indirection in it. Unfortunately, my real motivation here is to link a
msvc object(I don't have the source) which needs _environ. The object
code in it does not have this extra layer of indirection in it. I'm not
sure whether I can use libmsvcrt.a in the link now.

Kudos to Benny Riefenstahl for clueing me in.

Nigel

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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