[racket] FFI, string, malloc/free

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Sat Jun 15 07:55:40 EDT 2013

 What about 

(define-lib foo (fun _string -> _void))

(foo "Test")


Will be the pointer from string "Test" freed? And how to make it retain, if I need to save it on the foreign side?

Суббота, 15 июня 2013, 13:29 +02:00 от Laurent <laurent.orseau at gmail.com>:
>You probably want `register-finalizer':
>See also:
>Regarding the default behavior, I think Racket does not free automatically what it did not allocate itself.
>So the lib you're linking to either has functions to do the allocation/deallocation, or its doc should say what you need to free yourself.
>On Sat, Jun 15, 2013 at 12:47 PM, Клочков Роман  < kalimehtar at mail.ru > wrote:
>>When I describe type
>>(_fun _string -> _string)
>>where can I put, whether these string c-pointers should be freed after function call? Also, what is default behavior?
>>Роман Клочков
>>  Racket Users list:
>>   http://lists.racket-lang.org/users

Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130615/7babf726/attachment.html>

Posted on the users mailing list.