<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        Hi Nicolas.<div><br></div><div>> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">The convention would be char* <=> Null terminated string, byte* <=> </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">uninterpreted bytes</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Ah! Good to know. So, for byte* there would be an additional field (in a struct) for the size?</span></div><div><br></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Best,</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Marcel</span></div><div class="mb_sig"></div>
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 10.06.2020 17:41:33 schrieb Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif"> Maybe there is also the option of declaring it byte *?
<br>The convention would be char* <=> Null terminated string, byte* <=>
<br>uninterpreted bytes
<br>
<br>Le mer. 10 juin 2020 à 15:14, Marcel Taeumel <marcel.taeumel@hpi.de> a
<br>écrit :
<br>
<br>>
<br>> Hi all,
<br>>
<br>> I just found out that you can avoid this automatic interpretation as C
<br>> string if you use a type alias to char*. This could at least help if an
<br>> external library forgets the NULL character for that returned char* and
<br>> makes your VM crash. :-)
<br>>
<br>> Best,
<br>> Marcel
<br>>
<br>> Am 10.06.2020 12:35:27 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:
<br>> Hi all!
<br>>
<br>> The FFI plugin automatically converts "char*" return values into a
<br>> Smalltalk string when returning from the FFI call.
<br>>
<br>> I would rather leave this conversion to the image side because you have to
<br>> do it anyway when interpreting external structures. See ExternalData >>
<br>> #fromCString. And because it can be dangerous. Note that I do like
<br>> automatic String-to-char* conversion when making an FFI call. Just not the
<br>> other way around.
<br>>
<br>> See (Threaded)FFIPlugin >> #ffiReturnCStringFrom:.
<br>>
<br>> What are your thoughts on this matter?
<br>>
<br>> Best,
<br>> Marcel
<br>>
<br>>
<br><div dir="ltr"><div>Maybe there is also the option of declaring it byte *?</div><div>The convention would be char* <=> Null terminated string, byte* <=> uninterpreted bytes<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 10 juin 2020 à 15:14, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left: 1px solid rgb(204,204,204);padding-left: 1ex;min-width: 500px"> <div><div id="gmail-m_-3295475754161837209__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">
<br>                                        Hi all,<div><br></div><div>I just found out that you can avoid this automatic interpretation as C string if you use a type alias to char*. This could at least help if an external library forgets the NULL character for that returned char* and makes your VM crash. :-)</div><div><br></div><div>Best,</div><div>Marcel</div><div></div><blockquote type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<br>                        <p style="color:rgb(170,170,170);margin-top:10px">Am 10.06.2020 12:35:27 schrieb Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_-3295475754161837209__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0)">Hi all!<div></div><div><br></div><div>The FFI plugin automatically converts "char*" return values into a Smalltalk string when returning from the FFI call.</div><div><br></div><div>I would rather leave this conversion to the image side because you have to do it anyway when interpreting external structures. See ExternalData >> #fromCString. And because it can be dangerous. Note that I do like automatic String-to-char* conversion when making an FFI call. Just not the other way around.</div><div><br></div><div>See (Threaded)FFIPlugin >> #ffiReturnCStringFrom:.</div><div><br></div><div>What are your thoughts on this matter?</div><div><br></div><div>Best,</div><div>Marcel</div></div></div></blockquote>
<br>                                        </div></div></blockquote></div>
<br></marcel.taeumel@hpi.de></marcel.taeumel@hpi.de><!--=--><!--=--></div></blockquote></div>