Overview
Comment: | Work around dlsym() API not being valid C
This only silences the compiler. Storing function pointers in void* is |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4a2f61814f1ec167a18e7e064047eee0 |
User & Date: | js on 2014-05-15 15:32:42 |
Original User & Date: | js on 2014-05-15 15:32:43 |
Other Links: | manifest | tags |
Context
2014-05-15
| ||
15:32 | Enable -pedantic check-in: 9c0f66d49d user: js tags: trunk | |
15:32 | Work around dlsym() API not being valid C check-in: 4a2f61814f user: js tags: trunk | |
15:32 | Fix a few instances of signed vs. unsigned check-in: 7f0359ce68 user: js tags: trunk | |
Changes
Modified src/OFPlugin.m from [28a68da273] to [a5b4d66f4b].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 | #import "autorelease.h" #ifdef _WIN32 # define dlsym(handle, symbol) GetProcAddress(handle, symbol) # define dlclose(handle) FreeLibrary(handle) #endif @implementation OFPlugin + (id)pluginFromFile: (OFString*)path { void *pool = objc_autoreleasePoolPush(); of_plugin_handle_t handle; | > > | | | | 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 58 59 60 61 62 63 64 65 66 67 68 69 | #import "autorelease.h" #ifdef _WIN32 # define dlsym(handle, symbol) GetProcAddress(handle, symbol) # define dlclose(handle) FreeLibrary(handle) #endif typedef OFPlugin* (*init_plugin_t)(void); @implementation OFPlugin + (id)pluginFromFile: (OFString*)path { void *pool = objc_autoreleasePoolPush(); of_plugin_handle_t handle; init_plugin_t initPlugin; OFPlugin *plugin; path = [path stringByAppendingString: @PLUGIN_SUFFIX]; #ifndef _WIN32 if ((handle = dlopen([path cStringWithEncoding: [OFString nativeOSEncoding]], RTLD_LAZY)) == NULL) #else if ((handle = LoadLibraryW([path UTF16String])) == NULL) #endif @throw [OFInitializationFailedException exceptionWithClass: self]; objc_autoreleasePoolPop(pool); initPlugin = (init_plugin_t)(uintptr_t)dlsym(handle, "init_plugin"); if (initPlugin == (init_plugin_t)0 || (plugin = initPlugin()) == nil) { dlclose(handle); @throw [OFInitializationFailedException exceptionWithClass: self]; } plugin->_handle = handle; return plugin; |
︙ | ︙ |