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
|
#include <string.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#import "OFPlugin.h"
#import "OFString.h"
#import "OFLocale.h"
#import "OFInitializationFailedException.h"
#import "OFLoadPluginFailedException.h"
typedef OFPlugin *(*init_plugin_t)(void);
of_plugin_handle_t
of_dlopen(OFString *path, int flags)
{
#ifndef OF_WINDOWS
return dlopen([path cStringWithEncoding: [OFLocale encoding]], flags);
#else
if (path == nil)
return GetModuleHandle(NULL);
return LoadLibraryW(path.UTF16String);
#endif
}
void *
of_dlsym(of_plugin_handle_t handle, const char *symbol)
{
#ifndef OF_WINDOWS
|
>
|
>
|
>
>
>
|
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
|
#include <string.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#import "OFPlugin.h"
#import "OFLocale.h"
#import "OFString.h"
#import "OFSystemInfo.h"
#import "OFInitializationFailedException.h"
#import "OFLoadPluginFailedException.h"
typedef OFPlugin *(*init_plugin_t)(void);
of_plugin_handle_t
of_dlopen(OFString *path, int flags)
{
#ifndef OF_WINDOWS
return dlopen([path cStringWithEncoding: [OFLocale encoding]], flags);
#else
if (path == nil)
return GetModuleHandle(NULL);
if ([OFSystemInfo isWindowsNT])
return LoadLibraryW(path.UTF16String);
else
return LoadLibraryA(
[path cStringWithEncoding: [OFLocale encoding]]);
#endif
}
void *
of_dlsym(of_plugin_handle_t handle, const char *symbol)
{
#ifndef OF_WINDOWS
|