summaryrefslogtreecommitdiff
path: root/jim-win32compat.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-10-20 10:55:07 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-30 20:07:28 +1000
commit8016c1d53332b9ad2af8e49482f7848648995a89 (patch)
treee45d82799d638cdfcc2020e7cc05131b60049384 /jim-win32compat.c
parentbbd43ee01fce3a2b5284154c50dfc9994c913a29 (diff)
Allow extensions to be built/installed as modules
This includes C extensions and Tcl extensions Also adds windows support (mingw32 and cygwin) Now the sqlite*, readline and win32 extensions are supported Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-win32compat.c')
-rw-r--r--jim-win32compat.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/jim-win32compat.c b/jim-win32compat.c
index 76e7a96..bbda937 100644
--- a/jim-win32compat.c
+++ b/jim-win32compat.c
@@ -1,5 +1,34 @@
#include <jim.h>
+#ifdef HAVE_DLOPEN_COMPAT
+void *dlopen(const char *path, int mode)
+{
+ JIM_NOTUSED(mode);
+
+ return (void *)LoadLibraryA(path);
+}
+
+int dlclose(void *handle)
+{
+ FreeLibrary((HANDLE)handle);
+ return 0;
+}
+
+void *dlsym(void *handle, const char *symbol)
+{
+ return GetProcAddress((HMODULE)handle, symbol);
+}
+
+const char *dlerror(void)
+{
+ static char msg[121];
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
+ LANG_NEUTRAL, msg, sizeof(msg) - 1, NULL);
+ return msg;
+}
+#endif
+
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
/* POSIX gettimeofday() compatibility for WIN32 */
int gettimeofday(struct timeval *tv, void *unused)
{
@@ -88,29 +117,4 @@ struct dirent *readdir(DIR * dir)
}
return result;
}
-
-void *dlopen(const char *path, int mode)
-{
- JIM_NOTUSED(mode);
-
- return (void *)LoadLibraryA(path);
-}
-
-int dlclose(void *handle)
-{
- FreeLibrary((HANDLE)handle);
- return 0;
-}
-
-void *dlsym(void *handle, const char *symbol)
-{
- return GetProcAddress((HMODULE)handle, symbol);
-}
-
-const char *dlerror(void)
-{
- static char msg[121];
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
- LANG_NEUTRAL, msg, sizeof(msg) - 1, NULL);
- return msg;
-}
+#endif