cygwin compiled DLLs

Tue Dec 15 17:07:00 GMT 1998

> -----Original Message-----
> From:	Matthew Brett []
> Sent:	Monday, December 14, 1998 12:14
> To:;
> Cc:
> Subject:	cygwin compiled DLLs
> Dear Mumit / fellow DLL sufferers,
> Thanks for all your stuff on DLLs on the list, which has been very
> helpful.  Sadly, though, I am still stuck trying to link a
> Cygwin DLL to a Visual C calling program (and also get a working
> matlab mex file from Cygwin, which was my main aim).
> I am using b20.1 on NT4 sp3 FAT, and VC++ 4.2.
> I think I have tried everything in the dllhelpers 0.2.1 package,
> and still get invalid memory references as soon as I try and
> access any DLL routine, from a VC binary.  I've attached the
> very simple code that I have been using.
> Have I made some silly mistake somewhere?
> Should I expect this to work yet?

I'm not sure; the problem I think is that you mix CRunTime DLLs: when compiling 
with VC++, your code includes references to msvcrt.dll, where, for example, 
malloc/free and open/read/write/close (as well as stdin/stdout assignment code) 
is defined; when you enter your DLL, you get the same routines, but from 

To confirm that type "cygcheck VC++-compile-prog"; if you get references to 
both msvcrt.dll and cygwin.dll, you're stuck!...

In my mind what you want to do will only be possible if, when compiling with 
VC++, you use the include files from the cygwin release, not those from the 
VC++ release and only use cygwin.dll (not any other cygwin-provided libraries, 
as these are '.a' that I'm not sure that VC++ can read, nor any VC++ provided 
LIB or DLL, as these will most certainly reference msvcrt.DLL)...

I'm afraid that, if I'm right, that using VC++ and cygwin is not a very useful 

The moral here maybe that either you write uniw programs, and you have to use 
cygwin, or you write windows programs, and you may use either gcc (with 
-mno-cygwin and corrected libraries from Mumit) or you use VC++...

Hope this helps, (even if for you I hope to be wrong...)



> I would be very very grateful for any further thoughts, as I
> am now stuck.
> Thanks a lot,
> Matthew Brett

Bernard Dautrevaux
Microprocess Ingéniérie
97 bis, rue de Colombes
Tel: +33 (0) 1 47 68 80 80
Fax: +33 (0) 1 47 88 97 85
e-mail: b.

For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list