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?


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to