Look at what we have in OpenCOBOL for
dynamic loading of modules :
#ifdef USE_LIBDL
#include <dlfcn.h>
#define lt_dlopen(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
#define lt_dlsym(x, y) dlsym(x, y)
#define lt_dlclose(x) dlclose(x)
#define lt_dlerror() dlerror()
#define lt_ptr_t void *
#define lt_dlhandle void *
#elif defined(_WIN32)
#include <windows.h>
/* Prototype */
static char * lt_dlerror (void);
static HMODULE
lt_dlopen (const char *x)
{
if (x == NULL) {
return GetModuleHandle(NULL);
}
return LoadLibrary(x);
}
#define lt_dlsym(x, y) GetProcAddress(x, y)
#define lt_dlclose(x) FreeLibrary(x)
static char errbuf[64];
static char *
lt_dlerror()
{
sprintf(errbuf, "LoadLibrary/GetProcAddress error %d",
(int)GetLastError());
return errbuf;
}
#define lt_ptr_t void *
#define lt_dlinit()
#define lt_dlhandle HMODULE
#else
#define LT_NON_POSIX_NAMESPACE 1
#include <ltdl.h>
#endif
The app is coded to use the lt_dl calls.
Configure sorts out when USE_LIBDL is set
(native loading, eg. Linux, Cygwin), else redefine when Windows, else
use ltdl.
Roger
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool