Opening a (cygwin-ised) DLL

John Emmas johne53@tiscali.co.uk
Mon Nov 24 17:02:00 GMT 2008


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/



More information about the Cygwin mailing list