[Gc] Addition of GC_API/GC_CALL to gc_mark interface

Ivan Maidanski ivmai at mail.ru
Mon Oct 27 09:50:01 PST 2008


Hi!

This patch adds GC_API and GC_CALL declarators to the exported funcs and vars declared in gc_mark.h.

Without this patch it's impossible to compile test.c for Win32 with GC_DLL.

Bye.

-------------- next part --------------
diff -ru bdwgc/dbg_mlc.c updated/bdwgc/dbg_mlc.c
--- bdwgc/dbg_mlc.c	2008-10-27 14:19:56.000000000 +0300
+++ updated/bdwgc/dbg_mlc.c	2008-10-27 18:18:38.000000000 +0300
@@ -328,7 +328,8 @@
 
 static GC_describe_type_fn GC_describe_type_fns[MAXOBJKINDS] = {0};
 
-void GC_CALL GC_register_describe_type_fn(int kind, GC_describe_type_fn fn)
+GC_API void GC_CALL GC_register_describe_type_fn(int kind,
+						GC_describe_type_fn fn)
 {
   GC_describe_type_fns[kind] = fn;
 }
diff -ru bdwgc/include/gc_mark.h updated/bdwgc/include/gc_mark.h
--- bdwgc/include/gc_mark.h	2008-10-25 10:03:02.000000000 +0400
+++ updated/bdwgc/include/gc_mark.h	2008-10-27 16:00:04.000000000 +0300
@@ -106,8 +106,8 @@
 			/* held.					*/
 #define GC_INDIR_PER_OBJ_BIAS 0x10
 			
-extern void * GC_least_plausible_heap_addr;
-extern void * GC_greatest_plausible_heap_addr;
+GC_API void * GC_least_plausible_heap_addr;
+GC_API void * GC_greatest_plausible_heap_addr;
 			/* Bounds on the heap.  Guaranteed valid	*/
 			/* Likely to include future heap expansion.	*/
 			/* Hence usually includes not-yet-mapped	*/
@@ -132,7 +132,7 @@
 /* which would tie the client code to a fixed collector version.)	*/
 /* Note that mark procedures should explicitly call FIXUP_POINTER()	*/
 /* if required.								*/
-struct GC_ms_entry *GC_mark_and_push(void * obj,
+GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void * obj,
 			  	     struct GC_ms_entry * mark_stack_ptr,
 		          	     struct GC_ms_entry * mark_stack_limit,
 				     void * *src);
@@ -143,7 +143,7 @@
 	  GC_mark_and_push(obj, msp, lim, src) : \
 	  msp)
 
-extern size_t GC_debug_header_size;
+GC_API size_t GC_debug_header_size;
        /* The size of the header added to objects allocated through    */
        /* the GC_debug routines.                                       */
        /* Defined as a variable so that client mark procedures don't   */
@@ -155,22 +155,24 @@
 /* The _inner versions assume the caller holds the allocation lock.	*/
 
 /* Return a new free list array.	*/
-void ** GC_new_free_list(void);
-void ** GC_new_free_list_inner(void);
+GC_API void ** GC_CALL GC_new_free_list(void);
+GC_API void ** GC_CALL GC_new_free_list_inner(void);
 
 /* Return a new kind, as specified. */
-unsigned GC_new_kind(void **free_list, GC_word mark_descriptor_template,
-		int add_size_to_descriptor, int clear_new_objects);
+GC_API unsigned GC_CALL GC_new_kind(void **free_list,
+				GC_word mark_descriptor_template,
+				int add_size_to_descriptor,
+				int clear_new_objects);
 		/* The last two parameters must be zero or one. */
-unsigned GC_new_kind_inner(void **free_list,
+GC_API unsigned GC_CALL GC_new_kind_inner(void **free_list,
 		      GC_word mark_descriptor_template,
 		      int add_size_to_descriptor,
 		      int clear_new_objects);
 
 /* Return a new mark procedure identifier, suitable for use as	*/
 /* the first argument in GC_MAKE_PROC.				*/
-unsigned GC_new_proc(GC_mark_proc);
-unsigned GC_new_proc_inner(GC_mark_proc);
+GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc);
+GC_API unsigned GC_CALL GC_new_proc_inner(GC_mark_proc);
 
 /* Allocate an object of a given kind.  Note that in multithreaded	*/
 /* contexts, this is usually unsafe for kinds that have the descriptor	*/
@@ -178,7 +180,7 @@
 /* the descriptor is not correct.  Even in the single-threaded case,	*/
 /* we need to be sure that cleared objects on a free list don't		*/
 /* cause a GC crash if they are accidentally traced.			*/
-void * GC_generic_malloc(size_t lb, int k);
+GC_API void * GC_CALL GC_generic_malloc(size_t lb, int k);
 
 typedef void (GC_CALLBACK * GC_describe_type_fn) (void *p, char *out_buf);
 				/* A procedure which			*/
@@ -194,7 +196,8 @@
 				/* global free list.			*/
 #	define GC_TYPE_DESCR_LEN 40
 
-void GC_CALL GC_register_describe_type_fn(int kind, GC_describe_type_fn knd);
+GC_API void GC_CALL GC_register_describe_type_fn(int kind,
+						GC_describe_type_fn knd);
 				/* Register a describe_type function	*/
 				/* to be used when printing objects	*/
 				/* of a particular kind.		*/
diff -ru bdwgc/malloc.c updated/bdwgc/malloc.c
--- bdwgc/malloc.c	2008-10-25 15:21:19.000000000 +0400
+++ updated/bdwgc/malloc.c	2008-10-27 16:00:24.000000000 +0300
@@ -147,7 +147,7 @@
     return op;
 }
 
-void * GC_generic_malloc(size_t lb, int k)
+GC_API void * GC_CALL GC_generic_malloc(size_t lb, int k)
 {
     void * result;
     DCL_LOCK_STATE;
diff -ru bdwgc/mark.c updated/bdwgc/mark.c
--- bdwgc/mark.c	2008-10-25 17:17:44.000000000 +0400
+++ updated/bdwgc/mark.c	2008-10-27 15:45:42.000000000 +0300
@@ -1343,7 +1343,7 @@
     GC_PUSH_ONE_STACK((ptr_t)p, MARKED_FROM_REGISTER);
 }
 
-struct GC_ms_entry *GC_mark_and_push(void *obj,
+GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj,
 				     mse *mark_stack_ptr,
 				     mse *mark_stack_limit,
 				     void **src)
diff -ru bdwgc/misc.c updated/bdwgc/misc.c
--- bdwgc/misc.c	2008-10-26 13:57:56.000000000 +0300
+++ updated/bdwgc/misc.c	2008-10-27 15:49:38.000000000 +0300
@@ -1093,7 +1093,7 @@
 }
 
 /* Helper procedures for new kind creation.	*/
-void ** GC_new_free_list_inner(void)
+GC_API void ** GC_CALL GC_new_free_list_inner(void)
 {
     void *result = GC_INTERNAL_MALLOC((MAXOBJGRANULES+1)*sizeof(ptr_t),
 		    		      PTRFREE);
@@ -1102,7 +1102,7 @@
     return result;
 }
 
-void ** GC_new_free_list(void)
+GC_API void ** GC_CALL GC_new_free_list(void)
 {
     void *result;
     LOCK();
@@ -1111,7 +1111,8 @@
     return result;
 }
 
-unsigned GC_new_kind_inner(void **fl, GC_word descr, int adjust, int clear)
+GC_API unsigned GC_CALL GC_new_kind_inner(void **fl, GC_word descr,
+					int adjust, int clear)
 {
     unsigned result = GC_n_kinds++;
 
@@ -1124,7 +1125,8 @@
     return result;
 }
 
-unsigned GC_new_kind(void **fl, GC_word descr, int adjust, int clear)
+GC_API unsigned GC_CALL GC_new_kind(void **fl, GC_word descr, int adjust,
+				    int clear)
 {
     unsigned result;
     LOCK();
@@ -1133,7 +1135,7 @@
     return result;
 }
 
-unsigned GC_new_proc_inner(GC_mark_proc proc)
+GC_API unsigned GC_CALL GC_new_proc_inner(GC_mark_proc proc)
 {
     unsigned result = GC_n_mark_procs++;
 
@@ -1142,7 +1144,7 @@
     return result;
 }
 
-unsigned GC_new_proc(GC_mark_proc proc)
+GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc proc)
 {
     unsigned result;
     LOCK();


More information about the Gc mailing list