aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <earthwings@gentoo.org>2015-03-11 20:00:11 -0700
committerTimothy Gu <timothygu99@gmail.com>2015-03-11 20:00:56 -0700
commit83432ba2df9a5f526d94370815e48b21a5beb424 (patch)
tree9ebd1ba67ad93d775ff0e2ecba5a65b7183971fe
parent87f5cd065c27148d983401f43f56d9432a2034ad (diff)
downloaddlfcn-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.c1
-rw-r--r--dlfcn.h14
2 files changed, 11 insertions, 4 deletions
diff --git a/dlfcn.c b/dlfcn.c
index 46c85ce..75f5c81 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -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:
diff --git a/dlfcn.h b/dlfcn.h
index 413c0ab..06c3529 100644
--- a/dlfcn.h
+++ b/dlfcn.h
@@ -24,6 +24,12 @@
24extern "C" { 24extern "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
44void *dlopen ( const char *file, int mode ); 50DLFCN_EXPORT void *dlopen ( const char *file, int mode );
45int dlclose( void *handle ); 51DLFCN_EXPORT int dlclose(void *handle);
46void *dlsym ( void *handle, const char *name ); 52DLFCN_EXPORT void *dlsym(void *handle, const char *name);
47char *dlerror( void ); 53DLFCN_EXPORT char *dlerror(void);
48 54
49#ifdef __cplusplus 55#ifdef __cplusplus
50} 56}