[gambit-list] C pointers
Thomas Hafner
thomas at hafner.nl.eu.org
Fri Dec 31 11:39:20 EST 2004
Some given C functions receive pointers and manipulate the memory
where the pointers are pointing to. How should my c-lamda expression
look like to mach that requirement?
Here's a simple example (not real, but to show my problem). If the
given C Funktion looks like that:
void inc_int(int *pI)
{
(*pI)++;
}
Is it then Ok to use it from Gambit 4.0 beta 11 like follows?
(define inc-int
(c-lambda ((pointer int))
void
"inc_int"))
If yes: what can I pass to inc-int? How to express the Scheme
equivalent to the C pointer?
Otherwise: how should my Scheme procedure definition look like? Of
course the example above is a very simple one. A good solution should
also work with more complicated C functions, e.g. of type
int () (int *, char **).
Regards
Thomas Hafner
More information about the Gambit-list
mailing list