diff --git a/src/xpdev/xp_dl.c b/src/xpdev/xp_dl.c index 1e1fb972b4927fde3c027ffb19310158f6377999..31cfcf8387bd004ea2ee26490e1e5a882d1848f8 100644 --- a/src/xpdev/xp_dl.c +++ b/src/xpdev/xp_dl.c @@ -1,6 +1,7 @@ #include "dirwrap.h" #include "xp_dl.h" +#ifndef STATIC_LINK #if defined(__unix__) xp_dlopen(const char *name, int mode, int major, int minor) { @@ -32,6 +33,6 @@ xp_dlopen(const char *name, int mode, int major, int minor) return(NULL); } #endif - +#endif #endif diff --git a/src/xpdev/xp_dl.h b/src/xpdev/xp_dl.h index be73b9e83ba3685f07d517d7d6b35f82c0a9b926..6fd8c0619ba054464a0e4fbd56a440298fbcd2f3 100644 --- a/src/xpdev/xp_dl.h +++ b/src/xpdev/xp_dl.h @@ -3,18 +3,20 @@ #include "wrapdll.h" +#ifndef STATIC_LINK #if defined(__unix__) #include <dlfcn.h> typedef void * dll_handle; - #define xp_dlsym(handle, name) dlsym(handle, name) + DLLEXPORT void* DLLCALL xp_dlopen(const char *name, int mode, int major, int minor); + #define xp_dlsym(handle, name) dlsym(handle, #name) #define xp_dlclose(handle) dlclose(handle) #elif defined(_WIN32) #include <Winbase.h> typedef HMODULE WINAPI dll_handle; #define xp_dlopen(name, mode, major, minor) LoadLibrary(name) - #define xp_dlsym(handle, name) ((void *)GetProcAddress(handle, name)) + #define xp_dlsym(handle, name) ((void *)GetProcAddress(handle, #name)) #define xp_dlclose(handle) (FreeLibrary(handle)?0:-1) /* Unused values for *nix compatability */ @@ -26,7 +28,12 @@ ,RTLD_TRACE }; #endif +#else + typedef void* dll_handle; -DLLEXPORT void* DLLCALL xp_dlopen(const char *name, int mode, int major, int minor); + #define xp_dlopen(name, mode, major, minor) (name) + #define xp_dlsym(handle, name) (name) + #define xp_dlclose(handle) (0) +#endif #endif