<HTML><BODY>What about <br><br>(define-lib foo (fun _string -> _void))<br><br>(foo "Test")<br><br>?<br><br>Will be the pointer from string "Test" freed? And how to make it retain, if I need to save it on the foreign side?<br><br><br>Суббота, 15 июня 2013, 13:29 +02:00 от Laurent <laurent.orseau@gmail.com>:<br>
<blockquote style="border-left-width: 1px; border-left-style: solid; border-left-color: rgb(8, 87, 166); margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 10px; position: static; z-index: auto; " class="mailru-blockquote">
        <div id="">
        
        
        
        
        
        
        
        
<div class="js-helper js-readmsg-msg">
        <style type="text/css"></style>
        <div id="style_13712957950000000386" class="mr_read__body">
                <base target="_self" href="https://e.mail.ru/">
                
                        <div id="style_13712957950000000386_BODY"><div dir="ltr"><div>You probably want `register-finalizer':<br><a href="http://docs.racket-lang.org/foreign/foreign_pointer-funcs.html#%28def._%28%28lib._ffi/unsafe..rkt%29._register-finalizer%29%29" target="_blank">http://docs.racket-lang.org/foreign/foreign_pointer-funcs.html#%28def._%28%28lib._ffi/unsafe..rkt%29._register-finalizer%29%29</a><br>
<br></div><div>See also:<br><a href="http://docs.racket-lang.org/foreign/Allocation_and_Finalization.html" target="_blank">http://docs.racket-lang.org/foreign/Allocation_and_Finalization.html</a><br><br></div><div>Regarding the default behavior, I think Racket does not free automatically what it did not allocate itself.<br>
</div>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.<br><div></div><div><div><br></div></div>Laurent<br></div><div>
<br><br><div>On Sat, Jun 15, 2013 at 12:47 PM, Клочков Роман <span dir="ltr"><<a href="sentmsg?mailto=mailto%3akalimehtar@mail.ru" target="_blank">kalimehtar@mail.ru</a>></span> wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>When I describe type<br><br>(_fun _string -> _string)<br><br>where can I put, whether these string c-pointers should be freed after function call? Also, what is default behavior?<span><font color="#888888"><br>
<br><br>-- <br>Роман Клочков</font></span></div>
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>
</div>
                        
                
                <base target="_self" href="https://e.mail.ru/">
        </div>
        
</div>
</div>
</blockquote>
<br>
<br>--
<br>Roman Klochkov<br></BODY></HTML>