Another g-wrap bug (with patch): enumerations create symbol conflicts

Derek Atkins warlord@MIT.EDU
19 Oct 2002 11:40:11 -0400


Rob,

I tracked down another g-wrap bug.  In this particular case the
enumeration C-code generator would create mutliple files that defined
the same (exported) variable.  This caused problems, specifically when
linking two g-wrap-generated C files together (either into the same
library or app or other non-lazy linking scenario) when both files
reference the same enum.

The fix is simple: turn the gw__enum__<type>_val_to_int_scm_func and
gw__enum__<type>_int_to_val_scm_func variables into 'static's.

The following patch makes this change, and I've tested it on my
gnucash build with sucess.

Thanks!

-derek

--- g-wrap-1.3.2-orig/g-wrap/enumeration.scm	Thu Jan  3 22:16:20 2002
+++ g-wrap-1.3.2/g-wrap/enumeration.scm		Sat Oct 19 11:17:54 2002
@@ -56,8 +56,8 @@
     (define (global-declarations-ccg type client-wrapset)
       (if (eq? client-wrapset wrapset)
           '()
-          (list "SCM " val->int-var-name ";\n"
-                "SCM " val->sym-var-name ";\n")))
+          (list "static SCM " val->int-var-name ";\n"
+                "static SCM " val->sym-var-name ";\n")))
     
     (define (global-definitions-ccg type client-wrapset)
       (if client-wrapset



-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available