This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
RE: cygwin compiled DLLs
- To: "'Matthew Brett'" <mbrett at cu dot rpms dot ac dot uk>, "khan at xraylith dot wisc dot edu" <khan at xraylith dot wisc dot edu>, "gnu-win32 at cygnus dot com" <gnu-win32 at cygnus dot com>
- Subject: RE: cygwin compiled DLLs
- From: Bernard DAUTREVAUX <b dot dautrevaux at usa dot net>
- Date: Tue, 15 Dec 1998 12:40:26 +0100
- Cc: "lars dot gregersen at private dot dk" <lars dot gregersen at private dot dk>
- Reply-To: "b dot dautrevaux at usa dot net" <b dot dautrevaux at usa dot net>
> -----Original Message-----
> From: Matthew Brett [SMTP:mbrett@cu.rpms.ac.uk]
> Sent: Monday, December 14, 1998 12:14
> To: khan@xraylith.wisc.edu; gnu-win32@cygnus.com
> Cc: lars.gregersen@private.dk
> 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
cygwin.dll...
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
tool...
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...)
Regards,
Bernard
>
> 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
92400 COURBEVOIE
FRANCE
Tel: +33 (0) 1 47 68 80 80
Fax: +33 (0) 1 47 88 97 85
e-mail: b. dautrevaux@usa.net
------------------------------------------------------------------------------
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".