[m-dev.] changes for DLL support

Fergus Henderson fjh at cs.mu.oz.au
Fri Aug 29 04:18:12 AEST 1997


Fergus Henderson, you wrote:
> 
> Here's a cleaned-up version of DLL support for Windows.
> I haven't tested this cleaned-up version on Windows yet,
> so it is possible that I have introduced a few bugs in
> the clean-up.

Indeed I did.  Here's some bug fixes.

configure.in:
runtime/conf.h.in:
	Define USE_DLLS in conf.h.

runtime/imp.h:
runtime/init.h:
runtime/memory.c:
runtime/table.c:
util/mkinit.c:
boehm_gc/gc.h:
	Conditionalize things on `#ifdef(USE_DLLS)' rather than on
	`#ifdef(__CYGWIN32__)'.  Testing for specific systems tends
	to lead to code that is difficult to maintain.

util/mkinit.c:
	Fix a bug: it was checking `#if defined(libmer_USE_DLL)', but it
	should have been checking `#if !defined(libmer_DEFINE_DLL)'.

Index: configure.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/configure.in,v
retrieving revision 1.104
diff -u -u -r1.104 configure.in
--- configure.in	1997/08/28 17:50:50	1.104
+++ configure.in	1997/08/28 17:55:10
@@ -1430,6 +1430,9 @@
 AC_SUBST(USE_DLLS)
 AC_SUBST(SHARED_LIBS)
 AC_SUBST(LIBRARY_RM_C)
+if test $USE_DLLS = "yes"; then
+	AC_DEFINE(USE_DLLS)
+fi
 #-----------------------------------------------------------------------------#
 if test "$BOOTSTRAP_MC" = ""; then
 	BOOTSTRAP_MC=mmc
cvs diff: Diffing util
Index: util/mkinit.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/util/mkinit.c,v
retrieving revision 1.18
diff -u -u -r1.18 mkinit.c
--- mkinit.c	1997/08/28 17:52:54	1.18
+++ mkinit.c	1997/08/28 17:57:48
@@ -83,13 +83,13 @@
 	"extern char *GC_stackbottom;\n"
 	"#endif\n"
 	"\n"
-	"#if defined(__CYGWIN32__)\n"
-	"  #if defined(libmer_USE_DLL)\n"
+	"#if defined(USE_DLLS)\n"
+	"  #if !defined(libmer_DEFINE_DLL)\n"
 	"       #define libmer_impure_ptr \\\n"
 	"		(*__imp_libmer_impure_ptr)\n"
 	"	extern void *libmer_impure_ptr;\n"
 	"  #endif\n"
-	"  #if defined(libmercury_USE_DLL)\n"
+	"  #if !defined(libmercury_DEFINE_DLL)\n"
 	"       #define libmercury_impure_ptr \\\n"
 	"		(*__imp_libmercury_impure_ptr)\n"
 	"	extern void *libmercury_impure_ptr;\n"
@@ -114,11 +114,11 @@
 	"** to take special steps to initialize _impure_ptr\n"
 	"** for the DLLs.\n"
 	"*/\n"
-	"#if defined(__CYGWIN32__)\n"
-	"  #if defined(libmer_USE_DLL)\n"
+	"#if defined(USE_DLLS)\n"
+	"  #if !defined(libmer_DEFINE_DLL)\n"
 	"	libmer_impure_ptr = _impure_ptr;\n"
 	"  #endif\n"
-	"  #if defined(libmercury_USE_DLL)\n"
+	"  #if !defined(libmercury_DEFINE_DLL)\n"
 	"	libmercury_impure_ptr = _impure_ptr;\n"
 	"  #endif\n"
 	"#endif\n"
cvs diff: Diffing runtime
Index: runtime/conf.h.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/conf.h.in,v
retrieving revision 1.19
diff -u -u -r1.19 conf.h.in
--- conf.h.in	1997/07/29 04:19:44	1.19
+++ conf.h.in	1997/08/28 17:56:26
@@ -175,4 +175,9 @@
 */
 #define MR_FULLARCH "unknown"
 
+/*
+** Should we build the Mercury libraries as Windows DLLs?
+*/
+#undef USE_DLLS
+
 #endif /* CONF_H */
Index: runtime/imp.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/imp.h,v
retrieving revision 1.111
diff -u -u -r1.111 imp.h
--- imp.h	1997/08/28 17:52:24	1.111
+++ imp.h	1997/08/28 17:58:30
@@ -23,7 +23,7 @@
 ** The following must come before any definitions of global variables.
 ** This is necessary to support DLLs on Windows.
 */
-#ifdef __CYGWIN32__
+#ifdef USE_DLLS
   #include "libmer_dll.h"
 #endif
 
Index: runtime/init.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/init.h,v
retrieving revision 1.17
diff -u -u -r1.17 init.h
--- init.h	1997/08/28 17:52:28	1.17
+++ init.h	1997/08/28 17:58:40
@@ -16,7 +16,7 @@
 ** The following must come before any definitions of global variables.
 ** This is necessary to support DLLs on Windows.
 */
-#if defined(__CYGWIN32__)
+#if USE_DLLS
   #include "libmer_dll.h"
 #endif
 
Index: runtime/memory.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/memory.c,v
retrieving revision 1.75
diff -u -u -r1.75 memory.c
--- memory.c	1997/08/28 17:52:34	1.75
+++ memory.c	1997/08/28 17:59:13
@@ -29,7 +29,7 @@
 
 /*---------------------------------------------------------------------------*/
 
-#ifdef __CYGWIN32__
+#ifdef USE_DLLS
   #include "libmer_dll.h"
 #endif
 #include "regs.h"	/* must come first, due to global register vars */
Index: runtime/table.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/table.c,v
retrieving revision 1.16
diff -u -u -r1.16 table.c
--- table.c	1997/08/28 17:52:37	1.16
+++ table.c	1997/08/28 17:59:18
@@ -15,7 +15,7 @@
 
 #define	HASHDEBUG
 
-#ifdef __CYGWIN32__
+#ifdef USE_DLLS
   #include	"libmer_dll.h"
 #endif
 
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing boehm_gc
Index: boehm_gc/gc.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/boehm_gc/gc.h,v
retrieving revision 1.15
diff -u -u -r1.15 gc.h
--- gc.h	1997/08/28 17:51:24	1.15
+++ gc.h	1997/08/28 18:12:12
@@ -36,7 +36,7 @@
 # define __GC
 # include <stddef.h>
 
-#if defined(__CYGWIN32__)
+#if defined(USE_DLLS)
 #include "libgc_dll.h"
 #endif
 
@@ -649,7 +649,7 @@
  * I don't know any other method for figuring out the start and
  * end of the main program's global data from inside a DLL.
  */
-#elif defined(__CYGWIN32__) && defined(GC_USE_DLL)
+#elif defined(__CYGWIN32__)
 #   define GC_INIT() { \
 		extern int _bss_start__, _data_end__; \
 		GC_add_roots((void *)&_bss_start__, (void *)&_data_end__); \
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list