Index: src/OFPlugin.h ================================================================== --- src/OFPlugin.h +++ src/OFPlugin.h @@ -17,13 +17,18 @@ #import "OFObject.h" @class OFString; #ifndef OF_WINDOWS +# include +# define OF_RTLD_LAZY RTLD_LAZY +# define OF_RTLD_NOW RTLD_NOW typedef void* of_plugin_handle_t; #else # include +# define OF_RTLD_LAZY 0 +# define OF_RTLD_NOW 0 typedef HMODULE of_plugin_handle_t; #endif OF_ASSUME_NONNULL_BEGIN Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -36,10 +36,13 @@ { #ifndef OF_WINDOWS return dlopen([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], flags); #else + if (path == nil) + return GetModuleHandle(NULL); + return LoadLibraryW([path UTF16String]); #endif } void* @@ -46,11 +49,11 @@ of_dlsym(of_plugin_handle_t handle, const char *symbol) { #ifndef OF_WINDOWS return dlsym(handle, symbol); #else - return GetProcAddress(handle, symbol); + return (void*)(uintptr_t)GetProcAddress(handle, symbol); #endif } void of_dlclose(of_plugin_handle_t handle) @@ -70,11 +73,11 @@ init_plugin_t initPlugin; OFPlugin *plugin; path = [path stringByAppendingString: @PLUGIN_SUFFIX]; - if ((handle = of_dlopen(path, RTLD_LAZY)) == NULL) + if ((handle = of_dlopen(path, OF_RTLD_LAZY)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; objc_autoreleasePoolPop(pool);