[Pharo-users] uFFI ExternalAddress challenges

Guillermo Polito guillermopolito at gmail.com
Wed Sep 11 05:47:37 EDT 2019



> El 11 sept 2019, a las 11:43, Tomaž Turk <tomaz.turk at ef.uni-lj.si> escribió:
> 
> >  Well, the pointer survives, the area of memory pointed by that pointer will be recycled with subsequent calls in general.
> 
> I'll pay special attention to that, but it's probably a matter of properly creating and releasing COM objects.
> 
> 
> I have another question - in FFI call, how would one send a wide string, as in 
> 
> void CallMethod(void * COMObj, wchar_t * MethodName)
> 
> I might have additional questions about UTF-8 and other code page nuances …

:D Windows is particularly different than other platforms.
In *nixes most APIs require a char* with the encoded bytes, which we can encode in Pharo doing something like

‘my string’ utf8Encoded => a byte array with the encoded string

But for windows, I think the best is to use their encoding APIs.
You’ll find the image already has some support for that, that we use to access environment variables and the working directory string.

Check the class Win32WideString and its class comment ;)

> 
> Best wishes,
> Tomaz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190911/390444cd/attachment.html>


More information about the Pharo-users mailing list