[cffi-devel] CFFI malloc free

Surendra Singhi efuzzyone at netscape.net
Mon Dec 19 06:37:23 UTC 2005


Hello,
 If I have a C function which allocates memory for a C string and returns a
pointer to this memory (return type char *).

Should the return type of this function be :string or :pointer? 

How do I deallocate this memory? Should I use `foreign-string-free' or
`foreign-free'. 

Is there any way this deallocation can be made automatic? Say, something
similar to clisp's `:malloc-free', or should I copy this foreign string as a
lisp string and then free the foreign string. 

Thanks.
 
-- 
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.html

,----
| WHY SHOULD WE SAVE TIGER?  	
| Ans: Saving the tiger means saving mankind..	
| 
| Help http://pudang.tripod.com/
| or https://secure.worldwildlife.org/forms/tiger_appeal_1.cfm
`----





More information about the cffi-devel mailing list