diff --git a/ghc/includes/Prelude.h b/ghc/includes/Prelude.h index ac19a186099f02528bada1e3f69e6aeef89b4dba..8c7deb534339b4a2947b52e2f2ad6dbed7b114ed 100644 --- a/ghc/includes/Prelude.h +++ b/ghc/includes/Prelude.h @@ -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 */ diff --git a/ghc/includes/Stg.h b/ghc/includes/Stg.h index d5fde9e0e9a82afbff8fec1fd2c4175b7b224714..081bcf992eca1b0849d7a63ef2352018b3a7aea0 100644 --- a/ghc/includes/Stg.h +++ b/ghc/includes/Stg.h @@ -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 * @@ -22,43 +22,14 @@ #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 index 0000000000000000000000000000000000000000..599d9e8a756e37d73fc902b49c052db90391c27c --- /dev/null +++ b/ghc/includes/StgDLL.h @@ -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__ */