Tony Sidaway wrote: > 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. > [...]
Hello, the address of the C function wrapping the define-external'ed Scheme procedure is unproblematic, because it will never change. The pointer to the C string data may become invalid, though, once the program returns from the library call. In order to make this safe, you would have to duplicate the string in the C heap (for example using strdup) or you would have to create a non-garbage-collected copy of the Scheme string (for example using object-copy) to pass that to the library routine. In either case you would have to release the string data later on when it is no longer needed. cu, Thomas _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
