Opening a (cygwin-ised) DLL

Eric Blake ebb9@byu.net
Mon Nov 24 17:47:00 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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             ebb9@byu.net
-----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

iEYEARECAAYFAkkqppwACgkQ84KuGfSFAYAn0gCeLwzNL2degOc//GNQ/xwCFGu8
L+wAoNLnnoZrzHUvnSPSEk1oquPK/+fz
=uZnE
-----END PGP SIGNATURE-----

--
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