Skip to content
Snippets Groups Projects
Commit 07a8980d authored by AndyGill's avatar AndyGill
Browse files

[project @ 1999-10-15 19:11:54 by andy]

Changing order of check for use of DLL for dynamic linking.
(Under cygwin, we still want to use DLL's).
parent dfb12323
No related merge requests found
......@@ -7,8 +7,8 @@
* Hugs version 1.4, December 1997
*
* $RCSfile: dynamic.c,v $
* $Revision: 1.5 $
* $Date: 1999/06/07 17:22:31 $
* $Revision: 1.6 $
* $Date: 1999/10/15 19:11:54 $
* ------------------------------------------------------------------------*/
#include "prelude.h"
......@@ -16,7 +16,41 @@
#include "errors.h"
#include "dynamic.h"
#if HAVE_DLFCN_H /* eg LINUX, SOLARIS, ULTRIX */
#if HAVE_WINDOWS_H && !defined(__MSDOS__)
#include <windows.h>
ObjectFile loadLibrary(fn)
String fn; {
return LoadLibrary(fn);
}
void* lookupSymbol(file,symbol)
ObjectFile file;
String symbol; {
return GetProcAddress(file,symbol);
}
const char *dlerror(void)
{
return "<unknown>";
}
void* getDLLSymbol(dll,symbol) /* load dll and lookup symbol */
String dll;
String symbol; {
ObjectFile instance = LoadLibrary(dll);
if (NULL == instance) {
/* GetLastError allegedly provides more detail - in practice,
* it tells you nothing more.
*/
ERRMSG(0) "Error while importing DLL \"%s\"", dll
EEND;
}
return GetProcAddress(instance,symbol);
}
#elif HAVE_DLFCN_H /* eg LINUX, SOLARIS, ULTRIX */
#include <stdio.h>
#include <dlfcn.h>
......@@ -65,40 +99,6 @@ String symbol; {
return (0 == shl_findsym(&instance,symbol,TYPE_PROCEDURE,&r)) ? r : 0;
}
#elif HAVE_WINDOWS_H && !defined(__MSDOS__)
#include <windows.h>
ObjectFile loadLibrary(fn)
String fn; {
return LoadLibrary(fn);
}
void* lookupSymbol(file,symbol)
ObjectFile file;
String symbol; {
return GetProcAddress(file,symbol);
}
const char *dlerror(void)
{
return "<unknown>";
}
void* getDLLSymbol(dll,symbol) /* load dll and lookup symbol */
String dll;
String symbol; {
ObjectFile instance = LoadLibrary(dll);
if (NULL == instance) {
/* GetLastError allegedly provides more detail - in practice,
* it tells you nothing more.
*/
ERRMSG(0) "Error while importing DLL \"%s\"", dll
EEND;
}
return GetProcAddress(instance,symbol);
}
#else /* Dynamic loading not available */
void* getDLLSymbol(dll,symbol) /* load dll and lookup symbol */
......
......@@ -8,8 +8,8 @@
* Hugs version 1.4, December 1997
*
* $RCSfile: prelude.h,v $
* $Revision: 1.3 $
* $Date: 1999/02/03 17:08:36 $
* $Revision: 1.4 $
* $Date: 1999/10/15 19:11:55 $
* ------------------------------------------------------------------------*/
#include "config.h"
......@@ -246,12 +246,12 @@ typedef void* HpPtr;
/* ToDo: this should probably go in dynamic.h - but then
* storage.h has to include dynamic.h!
*/
#if HAVE_DLFCN_H /* eg LINUX, SOLARIS, ULTRIX */
#if HAVE_WINDOWS_H && !defined(__MSDOS__)
typedef HINSTANCE ObjectFile;
#elif HAVE_DLFCN_H /* eg LINUX, SOLARIS, ULTRIX */
typedef void* ObjectFile;
#elif HAVE_DL_H /* eg HPUX */
typedef shl_t ObjectFile;
#elif HAVE_WINDOWS_H && !defined(__MSDOS__)
typedef HINSTANCE ObjectFile;
#else
#warning GHC file loading not available on this machine
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment