@@ -11,22 +11,31 @@ #include "config.h" #include #include + +#ifndef _WIN32 #include +#endif #import "OFPlugin.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" + +#ifdef _WIN32 +#define dlopen(file, mode) LoadLibrary(file) +#define dlsym(handle, symbol) GetProcAddress(handle, symbol) +#define dlclose(handle) FreeLibrary(handle) +#endif @implementation OFPlugin + pluginFromFile: (OFString*)path { OFAutoreleasePool *pool; OFString *file; - void *handle; + of_plugin_handle_t handle; OFPlugin *(*init_plugin)(); OFPlugin *plugin; pool = [[OFAutoreleasePool alloc] init]; file = [OFMutableString stringWithString: path]; @@ -35,12 +44,12 @@ if ((handle = dlopen([file cString], RTLD_LAZY)) == NULL) @throw [OFInitializationFailedException newWithClass: self]; [pool release]; - if ((init_plugin = dlsym(handle, "init_plugin")) == NULL || - (plugin = init_plugin()) == nil) { + init_plugin = (OFPlugin*(*)())dlsym(handle, "init_plugin"); + if (init_plugin == NULL || (plugin = init_plugin()) == nil) { dlclose(handle); @throw [OFInitializationFailedException newWithClass: self]; } plugin->handle = handle;