This is the mail archive of the
mailing list for the Cygwin project.
Re: Opening a (cygwin-ised) DLL
- From: Eric Blake <ebb9 at byu dot net>
- To: cygwin at cygwin dot com, johne53 at tiscali dot co dot uk
- Date: Mon, 24 Nov 2008 06:05:32 -0700
- Subject: Re: Opening a (cygwin-ised) DLL
- References: <003a01c94e17$0d87fcc0$4001a8c0@mycomputer>
-----BEGIN PGP SIGNED MESSAGE-----
According to John Emmas on 11/24/2008 2:28 AM:
> Suppose I'm building a Linux app under Cygwin and that app builds an
> executable and a DLL. At run time, what would be the preferred method
> for the executable to open the DLL under Cygwin - LoadLibrary() or
> dlopen() ?
Hands down dlopen.
> I'm assuming that dlopen() is better for portability - but given that the
> DLL is (presumably) a pretty standard Windows DLL, is there possibly
> an argument for using a preprocessor directive, like this ? - e.g.
No. Using LoadLibrary means you are going behind cygwin's back, and if
there is something that cygwin does as part of dlopen that you don't do
when you manually use LoadLibrary, then you are likely to lose the Posixy
semantics that cygwin was trying to give you. In other words, you should
treat dlopen as a wrapper around more action than just a simple
LoadLibrary, not as a synonym to LoadLibrary.
Don't work too hard, make some time for fun as well!
Eric Blake email@example.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html