Next: , Previous: , Up: Programming in C   [Contents][Index]


5.5 Defining New Foreign Object Types

The foreign object type facility is Guile’s mechanism for importing object and types from C or other languages into Guile’s system. If you have a C struct foo type, for example, you can define a corresponding Guile foreign object type that allows Scheme code to handle struct foo * objects.

To define a new foreign object type, the programmer provides Guile with some essential information about the type — what its name is, how many fields it has, and its finalizer (if any) — and Guile allocates a fresh type for it. Foreign objects can be accessed from Scheme or from C.