chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] What happens to a (non-simple) Scheme object sent to a f


From: Tony Sidaway
Subject: [Chicken-users] What happens to a (non-simple) Scheme object sent to a foreign function?
Date: Sat, 3 Feb 2007 16:50:41 +0000

I'm sending a Scheme string to a foreign (C) library as a c-string.
I also send it the address of a Scheme procedure created as
define-external--this address is sent as a c-pointer.

Later on I call a safe-foreign-lambda which will use the Scheme
function whose address I sent it as a callback, and one of the
arguments will be the c string I sent it earlier, which is otherwise
untouched by the library code.

I have no control over the C code--it's a third party library.

Is this safe?  Is there a risk that the c-string I passed to the
library will become stale through garbage collection?

It seems to work but maybe that's just by luck rather than good
planning.  I guess the pointer to the define-external procedure will
be okay.

Is there a better, safer way of doing this?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]