When building a specialized interpreter, it could be useful to have a variable
you can access both in Scheme an in C. Modifying such a variable in C must
modify the Scheme associated variable and, symmetrically, modifying it in Scheme
must modify the corresponding C variable. One way to do this connection consists
to create a special Scheme variable whose content is read/written by a special
getter/setter. Definition of such a variable, is done by calling the function
STk_define_C_variable. The C prototype for this function is
The following piece of code shows how we can connect the Scheme variable *errno* to the C variable errno:
After this call to STk_define_C_variable, reading (resp. writing) the value of the *errno* Scheme variable calls the get_errno (resp. set_errno) C function.