diff src/sysdll.c @ 1632:64eaceca611d

[xemacs-hg @ 2003-08-19 02:07:03 by james] Enable module building and running on Cygwin and MinGW.
author james
date Tue, 19 Aug 2003 02:07:16 +0000
parents 0879be053100
children 9fc738581a9d
line wrap: on
line diff
--- a/src/sysdll.c	Mon Aug 18 21:52:34 2003 +0000
+++ b/src/sysdll.c	Tue Aug 19 02:07:16 2003 +0000
@@ -210,11 +210,10 @@
 {
   return dld_get_symbol (n);
 }
-#elif defined (WIN32_NATIVE)
+#elif defined (WIN32_NATIVE) || defined (CYGWIN)
 
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
+#include "syswindows.h"
+#include "sysfile.h"
 
 int
 dll_init (const char *arg)
@@ -225,7 +224,10 @@
 dll_handle
 dll_open (const char *fname)
 {
-  return (dll_handle) LoadLibrary (fname);
+  Ibyte *winfname, *unifname;
+  LOCAL_TO_WIN32_FILE_FORMAT ((char *) fname, winfname);
+  C_STRING_TO_TSTR (winfname, unifname);
+  return (dll_handle) qxeLoadLibrary (unifname);
 }
 
 int
@@ -249,7 +251,10 @@
 const char *
 dll_error (dll_handle h)
 {
-  return "Windows DLL Error";
+  /* Since nobody frees the returned string, I have to make this ugly hack. */
+  static char err[32] = "Windows DLL Error ";
+  snprintf (&err[18], 14, "%lu", GetLastError ());
+  return err;
 }
 #elif defined(HAVE_DYLD)
 /* This section supports MacOSX dynamic libraries. Dynamically