[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another bug



Neel Krishnaswami <neelk@alum.mit.edu> writes:

> Hi, I've found a problem with function redefinitions:

here's the diff for the fix.  basically c functions (implementing goo
code) need to be declared static to work with dynamic linking and not
just always get the first defined version.  the only change is in
goo/c/dlgrt.h and no recompile of goo is necessary.  it only affects
the dynamic compilation.

i'll hopefully get a new version of goo out early next week with in
the very least a bunch of bug fixes.  thanks for all your bug
reports. 

jonathan

Index: dlgrt.h
===================================================================
RCS file: /projects/dynlangs/cvsroot/goo/c/dlgrt.h,v
retrieving revision 1.7
diff -c -r1.7 dlgrt.h
*** dlgrt.h	3 Jul 2002 22:14:33 -0000	1.7
--- dlgrt.h	7 Aug 2002 18:16:11 -0000
***************
*** 1,21 ****
  //// Copyright 2002, Jonathan Bachrach.  See file TERMS.
  
  #undef FUNFOR
! 
! #define FUNFOR(x)    extern P x##I(REGS)
! 
  #undef EXT
  #undef DEF
  #undef VARREF
  #undef VARSET
  #undef BOUNDP
  
! #define LOCNAM(x)    x##V
! #define EXT(x, m, n) static DLVAR_DAT LOCNAM(x) = { n, m, PNUL };
! #define DEF(x, m, n) static P x = PNUL; static DLVAR_DAT LOCNAM(x) = { n, m, PNUL };
! #define BOUNDP(x)    (P)YevalSast_evalYPbinding_boundQ((P)&LOCNAM(x))
! #define VARREF(x)    YevalSast_evalYPbinding_value((P)&LOCNAM(x))
! #define VARSET(x, v) YevalSast_evalYPbinding_value_setter((P)v, (P)&LOCNAM(x))
  
  
  #undef DYNEXT
--- 1,21 ----
  //// Copyright 2002, Jonathan Bachrach.  See file TERMS.
  
  #undef FUNFOR
! #undef FUNCODEDEF
  #undef EXT
  #undef DEF
  #undef VARREF
  #undef VARSET
  #undef BOUNDP
  
! #define FUNFOR(x)     static P x##I(REGS)
! #define FUNCODEDEF(x) static P x##I (REGS regs)
! #define LOCNAM(x)     x##V
! #define EXT(x, m, n)  static DLVAR_DAT LOCNAM(x) = { n, m, PNUL };
! #define DEF(x, m, n)  static P x = PNUL; static DLVAR_DAT LOCNAM(x) = { n, m, PNUL };
! #define BOUNDP(x)     (P)YevalSast_evalYPbinding_boundQ((P)&LOCNAM(x))
! #define VARREF(x)     YevalSast_evalYPbinding_value((P)&LOCNAM(x))
! #define VARSET(x, v)  YevalSast_evalYPbinding_value_setter((P)v, (P)&LOCNAM(x))
  
  
  #undef DYNEXT

> 
>   ;;; GOO
>   ;;; JONATHAN BACHRACH
>   ;;; MIT AI Lab
>   ;;; JUL 19, 2002
>   ;;; 
>   ;;; VERSION = 0.140
>   ;;; ROOT    = /tmp/goo/lib/goo/
> 
>   goo/user 0<= (df foo () "foo")
>   goo/user 0=> #{Met foo ()}
>   goo/user 0<= (foo)
>   goo/user 0=> "foo"
>   goo/user 0<= (df foo () "bar") ;; <-- I redefine foo
>   goo/user 0=> #{Met foo ()}
>   goo/user 0<= (foo)
>   goo/user 0=> "foo" ;; <-- now it should return "bar"
> 
> Incidentally, do you prefer I send bug reports to this mailing list,
> or report them directly via the bug tracker? 
> 
> -- 
> Neel Krishnaswami
> neelk@alum.mit.edu