[project @ 1999-10-15 19:11:54 by andy]
authorandy <unknown>
Fri, 15 Oct 1999 19:11:55 +0000 (19:11 +0000)
committerandy <unknown>
Fri, 15 Oct 1999 19:11:55 +0000 (19:11 +0000)
Changing order of check for use of DLL for dynamic linking.
(Under cygwin, we still want to use DLL's).

ghc/interpreter/dynamic.c
ghc/interpreter/prelude.h

index 3fb2a61..be6fa5b 100644 (file)
@@ -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"
 #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 */
index 8886a3a..3d41bb1 100644 (file)
@@ -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