diff options
author | Dennis Nienhüser <earthwings@gentoo.org> | 2015-03-11 20:00:11 -0700 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2015-03-11 20:00:56 -0700 |
commit | 83432ba2df9a5f526d94370815e48b21a5beb424 (patch) | |
tree | 9ebd1ba67ad93d775ff0e2ecba5a65b7183971fe | |
parent | 87f5cd065c27148d983401f43f56d9432a2034ad (diff) | |
download | dlfcn-win32-83432ba2df9a5f526d94370815e48b21a5beb424.tar.gz dlfcn-win32-83432ba2df9a5f526d94370815e48b21a5beb424.tar.bz2 dlfcn-win32-83432ba2df9a5f526d94370815e48b21a5beb424.zip |
Add import/export symbols for MSVC.
This results in an import .lib file.
Closes #4.
Some fixes by Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
-rw-r--r-- | dlfcn.c | 1 | ||||
-rw-r--r-- | dlfcn.h | 14 |
2 files changed, 11 insertions, 4 deletions
@@ -20,6 +20,7 @@ | |||
20 | #include <windows.h> | 20 | #include <windows.h> |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | 22 | ||
23 | #define DLFCN_WIN32_EXPORTS | ||
23 | #include "dlfcn.h" | 24 | #include "dlfcn.h" |
24 | 25 | ||
25 | /* Note: | 26 | /* Note: |
@@ -24,6 +24,12 @@ | |||
24 | extern "C" { | 24 | extern "C" { |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #if defined(DLFCN_WIN32_EXPORTS) | ||
28 | # define DLFCN_EXPORT __declspec(dllexport) | ||
29 | #elif defined (_MSC_VER) // FIXME: MinGW support | ||
30 | # define DLFCN_EXPORT __declspec(dllimport) | ||
31 | #endif | ||
32 | |||
27 | /* POSIX says these are implementation-defined. | 33 | /* POSIX says these are implementation-defined. |
28 | * To simplify use with Windows API, we treat them the same way. | 34 | * To simplify use with Windows API, we treat them the same way. |
29 | */ | 35 | */ |
@@ -41,10 +47,10 @@ extern "C" { | |||
41 | #define RTLD_DEFAULT 0 | 47 | #define RTLD_DEFAULT 0 |
42 | #define RTLD_NEXT 0 | 48 | #define RTLD_NEXT 0 |
43 | 49 | ||
44 | void *dlopen ( const char *file, int mode ); | 50 | DLFCN_EXPORT void *dlopen ( const char *file, int mode ); |
45 | int dlclose( void *handle ); | 51 | DLFCN_EXPORT int dlclose(void *handle); |
46 | void *dlsym ( void *handle, const char *name ); | 52 | DLFCN_EXPORT void *dlsym(void *handle, const char *name); |
47 | char *dlerror( void ); | 53 | DLFCN_EXPORT char *dlerror(void); |
48 | 54 | ||
49 | #ifdef __cplusplus | 55 | #ifdef __cplusplus |
50 | } | 56 | } |