blob: af595f454772444c80afbc639373c58264bdf03e (
plain)
1
2
3
4
5
6
7
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#if defined(__WIN32__)
#include <windows.h>
void *
grt_dynload_open (const char *path)
{
return (void *)LoadLibrary (path);
}
void *
grt_dynload_symbol (void *handle, const char *symbol)
{
return (void *)GetProcAddress ((HMODULE)handle, symbol);
}
const char *
grt_dynload_error (void)
{
static char msg[256];
FormatMessage
(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError (),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &msg,
sizeof (msg) - 1,
NULL);
return msg;
}
#else
#include <dlfcn.h>
void *
grt_dynload_open (const char *path)
{
return dlopen (path, RTLD_LAZY);
}
void *
grt_dynload_symbol (void *handle, const char *symbol)
{
return dlsym (handle, symbol);
}
const char *
grt_dynload_error (void)
{
return dlerror ();
}
#endif
|