[gambit-list] Problem with FFI & Memory Corruption

Marc Feeley feeley at iro.umontreal.ca
Sun Feb 12 18:00:12 EST 2012


On 2012-02-12, at 8:43 AM, Álvaro Castro-Castilla wrote:

> Hi Taylor,
> 
> Do you plan on making full bindings for libxml2? I'd be interested in packaging it as a Blackhole module when you are ready.
> Also, when following your steps I got this error:
> > (load "xml")
> *** WARNING -- Could not find C function: "____20_xml_2e_o1"
> *** ERROR IN (console)@1.1 -- /home/alvatar/gambit-xml/xml.o1: undefined symbol: ___release_scmobj
> 
> Using gambit 4.6.3
> 
> Best regards,
> 
> Álvaro

I'm not sure this is the cause of the bug, but I have noticed that Taylor's code is not completely portable.  It contains references to Gambit runtime functions that are not wrapped in a call to ___EXT. In other words, the calls

vect = ___make_vector(4, ___FAL, ___STILL);
___release_scmobj(x);
tmp = ___make_pair(x, lst, ___STILL);

should be written

vect = ___EXT(___make_vector)(4, ___FAL, ___STILL);
___EXT(___release_scmobj)(x);
tmp = ___EXT(___make_pair)(x, lst, ___STILL);

This is needed on some operating systems to link with the Gambit runtime system functions.  On the operating systems that don't need anything special, the call ___EXT(f) is replaced with f, so there is no overhead.

By the way, on which OS did this problem occur?

Marc




More information about the Gambit-list mailing list