From 539d72f60e5c616a31ffcf734505471790f4980c Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Tue, 4 May 1999 08:52:23 +0000 Subject: [PATCH] [project @ 1999-05-04 08:52:22 by sof] Moved DLL-related macros out of Stg.h and into separate .h file --- ghc/includes/Prelude.h | 4 ++-- ghc/includes/Stg.h | 40 ++++++-------------------------------- ghc/includes/StgDLL.h | 44 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 ghc/includes/StgDLL.h diff --git a/ghc/includes/Prelude.h b/ghc/includes/Prelude.h index ac19a186099f..8c7deb534339 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 d5fde9e0e9a8..081bcf992eca 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 000000000000..599d9e8a756e --- /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__ */ -- GitLab