From 93b5007746acdf5e7d73ef9943e1c595eacb2a0c Mon Sep 17 00:00:00 2001 From: Robert Carlsen Date: Wed, 8 Apr 2009 06:59:49 +0000 Subject: [PATCH] From Ned Harding: Basic implementation of dflcn header for win32 --- src/win32/dlfcn.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/win32/dlfcn.h diff --git a/src/win32/dlfcn.h b/src/win32/dlfcn.h new file mode 100644 index 000000000..4ee14a767 --- /dev/null +++ b/src/win32/dlfcn.h @@ -0,0 +1,24 @@ +// VERY simplistic implementation of dlfcn.h for win32 since it isn't a standard header on windows + +#ifndef DLFCN_H +#define DLFCN_H + +#define RTLD_NOW 2 + + +void *dlopen (const char *file, int /*mode*/) +{ + return LoadLibraryA(file); +} + +int dlclose (void *handle) +{ + return FreeLibrary((HINSTANCE)handle)==0 ? 0 : -1; +} + +void *dlsym (void *handle, const char *name) +{ + return (void *)GetProcAddress((HINSTANCE)handle, name); +} + +#endif // DLFCN_H