This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: Opening a (cygwin-ised) DLL

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   
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

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