Copyright (C) 2000-2012 |
GNU Info (g-wrap.info)Portable "Fancy tricks"Additional issues ***************** The most difficult issue with wrapping a C library for use with a Scheme interpreter seems to be the issue of memory management. g-wrap does not try to deal much with this issue because it is a messy one. One assumption made by the code generator is that objects are maintained in the Scheme world--when the interpreter no longer references an object, it may be garbage-collected and de-allocated. Another assumption _is that any object returned by a call to a C function is a new object_ which the interpreter will wrap in a new Scheme object. If this is not true, then it is possible for multiple Scheme objects to refer to a single C object, and serious errors can occur. I have written code which uses some fancy tricks to get around this problem for certain specific cases, but there is no simple way to deal with this problem in general without the C library to have specific support for helping the interpreter out. Future versions of g-wrap may incorporate some support for helping the C library cooperate with this issue by storing the Scheme representation of an object inside the object itself.
automatically generated by info2www version 1.2.2.9 |