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]

Opening a (cygwin-ised) DLL


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() ?

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.

#if defined(WIN32) || defined(__CYGWIN__)
#define LoadLib(name) LoadLibrary(name)
#else
#define LoadLib(name) dlopen((name), RTLD_NOW)
#endif

Obviously, the same kind of directives would need to be applied when unloading the library and getting symbol addresses etc.

Thanks,

John

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


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