comparison 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
comparison
equal deleted inserted replaced
1631:1bf7b032a45d 1632:64eaceca611d
208 DLL_FUNC 208 DLL_FUNC
209 dll_variable (dll_handle h, const char *n) 209 dll_variable (dll_handle h, const char *n)
210 { 210 {
211 return dld_get_symbol (n); 211 return dld_get_symbol (n);
212 } 212 }
213 #elif defined (WIN32_NATIVE) 213 #elif defined (WIN32_NATIVE) || defined (CYGWIN)
214 214
215 #define WIN32_LEAN_AND_MEAN 215 #include "syswindows.h"
216 #include <windows.h> 216 #include "sysfile.h"
217 #undef WIN32_LEAN_AND_MEAN 217
218 218 int
219 int 219 dll_init (const char *arg)
220 dll_init (const char *arg) 220 {
221 { 221 return 0;
222 return 0; 222 }
223 } 223
224 224 dll_handle
225 dll_handle 225 dll_open (const char *fname)
226 dll_open (const char *fname) 226 {
227 { 227 Ibyte *winfname, *unifname;
228 return (dll_handle) LoadLibrary (fname); 228 LOCAL_TO_WIN32_FILE_FORMAT ((char *) fname, winfname);
229 C_STRING_TO_TSTR (winfname, unifname);
230 return (dll_handle) qxeLoadLibrary (unifname);
229 } 231 }
230 232
231 int 233 int
232 dll_close (dll_handle h) 234 dll_close (dll_handle h)
233 { 235 {
247 } 249 }
248 250
249 const char * 251 const char *
250 dll_error (dll_handle h) 252 dll_error (dll_handle h)
251 { 253 {
252 return "Windows DLL Error"; 254 /* Since nobody frees the returned string, I have to make this ugly hack. */
255 static char err[32] = "Windows DLL Error ";
256 snprintf (&err[18], 14, "%lu", GetLastError ());
257 return err;
253 } 258 }
254 #elif defined(HAVE_DYLD) 259 #elif defined(HAVE_DYLD)
255 /* This section supports MacOSX dynamic libraries. Dynamically 260 /* This section supports MacOSX dynamic libraries. Dynamically
256 loadable libraries must be compiled as bundles, not dynamiclibs. 261 loadable libraries must be compiled as bundles, not dynamiclibs.
257 */ 262 */