Overview
Comment: | Add plugin support for Win32. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3194cede14206a1d7e510f9d4497eb20 |
User & Date: | js on 2009-10-19 08:31:10 |
Other Links: | manifest | tags |
Context
2009-10-19
| ||
22:09 | Automatically download UnicodeData.txt if it's missing. check-in: c5d489cefd user: js tags: trunk | |
08:31 | Add plugin support for Win32. check-in: 3194cede14 user: js tags: trunk | |
08:29 | Fix a bug in -[freeMemory:]. check-in: 6e357d636d user: js tags: trunk | |
Changes
Modified src/OFPlugin.h from [dcbe20abfe] to [707d5300db].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" #import "OFString.h" /** * The OFPlugin class provides a system for loading plugins at runtime. */ @interface OFPlugin: OFObject { | > > > > > > > | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" #import "OFString.h" #ifndef _WIN32 typedef void* of_plugin_handle_t; #else #include <windows.h> typedef HMODULE of_plugin_handle_t; #endif /** * The OFPlugin class provides a system for loading plugins at runtime. */ @interface OFPlugin: OFObject { of_plugin_handle_t handle; } /** * Loads an OFPlugin from a file. * * \param path Path to the OFPlugin file. The suffix is appended automatically. * \return The loaded OFPlugin |
︙ | ︙ |
Modified src/OFPlugin.m from [5285064f8a] to [7086c924a4].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * the packaging of this file. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <dlfcn.h> #import "OFPlugin.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" @implementation OFPlugin + pluginFromFile: (OFString*)path { OFAutoreleasePool *pool; OFString *file; | > > > > > > > > > | | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | * the packaging of this file. */ #include "config.h" #include <stdlib.h> #include <string.h> #ifndef _WIN32 #include <dlfcn.h> #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; of_plugin_handle_t handle; OFPlugin *(*init_plugin)(); OFPlugin *plugin; pool = [[OFAutoreleasePool alloc] init]; file = [OFMutableString stringWithString: path]; [file appendCString: PLUGIN_SUFFIX]; if ((handle = dlopen([file cString], RTLD_LAZY)) == NULL) @throw [OFInitializationFailedException newWithClass: self]; [pool release]; init_plugin = (OFPlugin*(*)())dlsym(handle, "init_plugin"); if (init_plugin == NULL || (plugin = init_plugin()) == nil) { dlclose(handle); @throw [OFInitializationFailedException newWithClass: self]; } plugin->handle = handle; return plugin; } |
︙ | ︙ |