GNU Info

Info Node: (g-wrap.info)Portable "Fancy tricks"

(g-wrap.info)Portable "Fancy tricks"


Prev: Extending g-wrap and porting it to other Scheme implementations Up: Top
Enter node , (file) or (file)node

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.

add-new-type
Defining basic Scheme/C types.
add-type <1>
Defining basic Scheme/C types.
add-type
Adding a new type.
get-type
Defining basic Scheme/C types.
gw_error
Utility functions.
gw_puts
Utility functions.
gwrap-assume-types-wrapped
Other functions needed for describing the library glue code.
gwrap-close-module
Other functions needed for describing the library glue code.
gwrap-generate-wrapped-header
Other functions needed for describing the library glue code.
gwrap-include-global-header
Other functions needed for describing the library glue code.
gwrap-include-local-header
Other functions needed for describing the library glue code.
gwrap-open-module
Other functions needed for describing the library glue code.
gwrap-scan-source-file
Scanning source code for functions to export.
make-c-type
Defining basic Scheme/C types.
make-complex-c-type
Defining basic Scheme/C types.
new-constant
Defining a new constant.
new-function
Manually defining functions.
new-type
Adding a new type.
pointer-array-length
Pointer Arrays.
pointer-array-ref
Pointer Arrays.

automatically generated by info2www version 1.2.2.9