[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/support dynlib.c,1.10,1.11
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/support dynlib.c,1.10,1.11 |
Date: |
Tue, 24 Jun 2003 01:10:44 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv26823/support
Modified Files:
dynlib.c
Log Message:
Use the "LoadLibrary" function under both cygwin and non-cygwin
win32 installations.
Index: dynlib.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/dynlib.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** dynlib.c 17 Jun 2003 05:08:50 -0000 1.10
--- dynlib.c 24 Jun 2003 05:10:42 -0000 1.11
***************
*** 21,26 ****
#include <stdio.h>
#include "il_system.h"
! #ifdef IL_WIN32_NATIVE
#include <windows.h>
#else
#ifdef HAVE_DLFCN_H
--- 21,31 ----
#include <stdio.h>
#include "il_system.h"
! #ifdef IL_WIN32_PLATFORM
#include <windows.h>
+ #ifndef IL_WIN32_NATIVE
+ #ifdef HAVE_SYS_CYGWIN_H
+ #include <sys/cygwin.h>
+ #endif
+ #endif
#else
#ifdef HAVE_DLFCN_H
***************
*** 156,159 ****
--- 161,225 ----
}
+ #elif defined(IL_WIN32_PLATFORM) /* Native Win32 or Cygwin */
+
+ void *ILDynLibraryOpen(const char *name)
+ {
+ void *libHandle;
+ char *newName = 0;
+
+ #if defined(IL_WIN32_CYGWIN) && defined(HAVE_SYS_CYGWIN_H) && \
+ defined(HAVE_CYGWIN_CONV_TO_WIN32_PATH)
+
+ /* Use Cygwin to expand the path */
+ {
+ char buf[4096];
+ if(cygwin_conv_to_win32_path(name, buf) == 0)
+ {
+ newName = ILDupString(buf);
+ if(!newName)
+ {
+ return 0;
+ }
+ }
+ }
+
+ #endif
+
+ /* Attempt to load the library */
+ libHandle = (void *)LoadLibrary((newName ? newName : name));
+ if(libHandle == 0)
+ {
+ fprintf(stderr, "%s: could not load dynamic library\n",
+ (newName ? newName : name));
+ if(newName)
+ {
+ ILFree(newName);
+ }
+ return 0;
+ }
+ if(newName)
+ {
+ ILFree(newName);
+ }
+ return libHandle;
+ }
+
+ void ILDynLibraryClose(void *handle)
+ {
+ FreeLibrary((HINSTANCE)handle);
+ }
+
+ void *ILDynLibraryGetSymbol(void *handle, const char *symbol)
+ {
+ void *procAddr;
+ procAddr = (void *)GetProcAddress((HINSTANCE)handle, symbol);
+ if(procAddr == 0)
+ {
+ fprintf(stderr, "%s: could not resolve symbol", symbol);
+ return 0;
+ }
+ return procAddr;
+ }
+
#elif defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)
***************
*** 239,272 ****
fprintf(stderr, "%s: %s\n", symbol, error);
return 0;
- }
-
- #elif defined(IL_WIN32_NATIVE) /* Native Win32 */
-
- void *ILDynLibraryOpen(const char *name)
- {
- void *libHandle = (void *)LoadLibrary(name);
- if(libHandle == 0)
- {
- fprintf(stderr, "%s: could not load dynamic library\n", name);
- return 0;
- }
- return libHandle;
- }
-
- void ILDynLibraryClose(void *handle)
- {
- FreeLibrary((HINSTANCE)handle);
- }
-
- void *ILDynLibraryGetSymbol(void *handle, const char *symbol)
- {
- void *procAddr;
- procAddr = (void *)GetProcAddress((HINSTANCE)handle, symbol);
- if(procAddr == 0)
- {
- fprintf(stderr, "%s: could not resolve symbol", symbol);
- return 0;
- }
- return procAddr;
}
--- 305,308 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/support dynlib.c,1.10,1.11,
Rhys Weatherley <address@hidden> <=