<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Michał --</span><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">> </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">As in the title, what's the way to pass single string to External</span></div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">> Function that expects array of strings (char**)?</span><div class="mb_sig"></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">The type model for pointer types with arity > 1 is still rudimentary. You can always go the unsafe way to code against 'void*'. In your case, the type 'char*[]' gives you an array type with a 'char*' content type. Not sure whether type coercing will work during the FFI call. You can also use the 'string[]' type for that matter. Again, if you get a type check error on the call, you might have to resort to 'void*' instead and pass on that ExternalAddress your have at hand.</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">(ExternalType typeNamed: 'char*[]') explore.</span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">(ExternalType typeNamed: 'string[]') explore.</span></span><br></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">> </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">I assume the new FFI interface will be released along with Squeak 6.0? :)</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">Well, I will make a tag so that everybody knows what to load in Squeak 6.0. Yet, active development will continue after that release against Trunk (e.g. 6.1alpha).</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">> </span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">are objects passed to FFI (the ones allocated</span></div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">> on the Squeak heap) auto-pinned or do I need pin them manually?</span><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">You have to do it manually if you really need to pass on object memory to a call and that callee holds on to the address after the return. No need to pin objects that are just read during the call. That is, for example, fill your RawBitsArray and pass it into the function as is. I think. Just check via #isPinned. Watch out for segfaults after GC. Might indicate that you do have to pin that object. :-D</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px"><br></span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">Best,<br>Marcel</span></span></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 02.04.2022 03:34:38 schrieb Michał Olszewski <m.olszewski@nexat.pl>:</p><div style="font-family:Arial,Helvetica,sans-serif">Hello,<br><br>As in the title, what's the way to pass single string to External <br>Function that expects array of strings (char**)? I know that the way to <br>do that in plain C would be something like this: &myString but I have <br>not idea how to manipulate Squeak objects such that I can pass their <br>addresses manually to FFI. I guess I have to somehow wrap stuff into <br>ExternalData but how?<br><br>The image used is: Squeak 6.0 alpha 21520.<br><br>I assume the new FFI interface will be released along with Squeak 6.0? :)<br><br>At last, quick question: are objects passed to FFI (the ones allocated <br>on the Squeak heap) auto-pinned or do I need pin them manually?<br><br>Michał<br><br><br></div></blockquote></div>