[project @ 1999-05-04 08:52:22 by sof]
authorsof <unknown>
Tue, 4 May 1999 08:52:23 +0000 (08:52 +0000)
committersof <unknown>
Tue, 4 May 1999 08:52:23 +0000 (08:52 +0000)
Moved DLL-related macros out of Stg.h and into separate .h file

ghc/includes/Prelude.h
ghc/includes/Stg.h
ghc/includes/StgDLL.h [new file with mode: 0644]

index ac19a18..8c7deb5 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Prelude.h,v 1.7 1999/03/17 13:19:19 simonm Exp $
+ * $Id: Prelude.h,v 1.8 1999/05/04 08:52:23 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -94,6 +94,6 @@ extern const StgInfoTable StablePtr_static_info;
 
 #endif
 
-#endif
+#endif /* COMPILING_RTS */
 
 #endif /* PRELUDE_H */
index d5fde9e..081bcf9 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stg.h,v 1.9 1999/03/15 16:30:25 simonm Exp $
+ * $Id: Stg.h,v 1.10 1999/05/04 08:52:22 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
 #include "options.h"
 #endif
 
+/* Some macros to handle DLLing (Win32 only at the moment). */
+#include "StgDLL.h"
+
 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
 #ifndef INTERPRETER
 #define COMPILER 1
 #endif
 
-/* This is a feature test - doesn't belong here. FixMe. */
-#ifdef __MINGW32__
-#define HAVE_WIN32_DLL_SUPPORT
-#endif
-
-#ifdef HAVE_WIN32_DLL_SUPPORT
-# if __GNUC__ && !defined(__declspec)
-#  define DLLIMPORT
-# else
-#  define DLLIMPORT __declspec(dllimport)
-#  define DLLIMPORT_DATA(x) _imp__##x
-# endif
-#else
-# define DLLIMPORT
-#endif
-
-#ifdef COMPILING_RTS
-#define DLL_IMPORT DLLIMPORT
-#define DLL_IMPORT_RTS
-#define DLL_IMPORT_DATA
-#define DLL_IMPORT_DATA_VAR(x) x
-#else
-#define DLL_IMPORT
-#define DLL_IMPORT_RTS DLLIMPORT
-#define DLL_IMPORT_DATA DLLIMPORT
-# ifdef HAVE_WIN32_DLL_SUPPORT
-#  define DLL_IMPORT_DATA_VAR(x) _imp__##x
-# else
-#  define DLL_IMPORT_DATA_VAR(x) x
-# endif
-#endif
-
 /* bit macros
  */
 #define BITS_PER_BYTE 8
@@ -160,7 +131,8 @@ extern char **environ;
 
 /* Creating and destroying an adjustor thunk.
    I cannot make myself create a separate .h file
-   for these two (sof.)
+   for these two (sof.) 
+   
 */
 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
 extern void  freeHaskellFunctionPtr(void* ptr);
diff --git a/ghc/includes/StgDLL.h b/ghc/includes/StgDLL.h
new file mode 100644 (file)
index 0000000..599d9e8
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __STGDLL_H__
+#define __STGDLL_H__ 1
+
+#if defined(HAVE_WIN32_DLL_SUPPORT) && !defined(DONT_WANT_WIN32_DLL_SUPPORT)
+#define ENABLE_WIN32_DLL_SUPPORT
+#endif
+
+#ifdef ENABLE_WIN32_DLL_SUPPORT
+# if __GNUC__ && !defined(__declspec)
+#  define DLLIMPORT
+# else
+#  define DLLIMPORT __declspec(dllimport)
+#  define DLLIMPORT_DATA(x) _imp__##x
+# endif
+#else
+# define DLLIMPORT
+#endif
+
+/* The view of the ghc/includes/ header files differ ever so
+   slightly depending on whether the RTS is being compiled
+   or not - so we're forced to distinguish between two.
+   [oh, you want details :) : Data symbols defined by the RTS
+    have to be accessed through an extra level of indirection
+    when compiling generated .hc code compared to when the RTS
+    sources are being processed. This is only the case when 
+    using Win32 DLLs. ]
+*/
+#ifdef COMPILING_RTS
+#define DLL_IMPORT DLLIMPORT
+#define DLL_IMPORT_RTS
+#define DLL_IMPORT_DATA
+#define DLL_IMPORT_DATA_VAR(x) x
+#else
+#define DLL_IMPORT
+#define DLL_IMPORT_RTS DLLIMPORT
+#define DLL_IMPORT_DATA DLLIMPORT
+# ifdef ENABLE_WIN32_DLL_SUPPORT
+#  define DLL_IMPORT_DATA_VAR(x) _imp__##x
+# else
+#  define DLL_IMPORT_DATA_VAR(x) x
+# endif
+#endif
+
+#endif /* __STGDLL_H__ */