[Pharo-users] uFFI ExternalAddress challenges

Guillermo Polito guillermopolito at gmail.com
Wed Sep 11 04:29:34 EDT 2019


Hi Thomas, 

Can you share more about the definition of your CallMethod function in C?
From the uFFI point of view the binding looks ok…

How are you opening Pharo? From the command line or the pharo launcher?
Are you on cygwin/mingw? One other possibility (since you’re playing with C libraries) is to launch Pharo inside a gdb/lldb so you can check the reason behind the error when it crashes.

Keep us posted,
Guille

> El 10 sept 2019, a las 19:53, Tomaž Turk <tomaz.turk at ef.uni-lj.si> escribió:
> 
> Dear all,
> 
> I'm struggling with passing an ExternalAddress to a c function call with uFFI. Firstly, I get the ExternalAddress from this method:
> 
> myFFI>>create: aString
>     ^ self 
>         ffiCall: #(void * CreateObject (String aString) ) 
> 
> [in c:
> void* CreateObject(char* szProgId)]
> 
> The method that uses the resulting ExternalAddress is defined as:
> 
> myFFI>>ask: anExternalAddress
>     ^ self 
>         ffiCall: #(void CallMethod (void * anExternalAddress) )
> 
> [in c:
> void CallMethod(void* myObj)]
> 
> In playground I have
> 
> | w |
> w := myFFI create: 'Word.Application'.
> myFFI ask: w .
> 
> w gets a "nice", properly looking external address, however the last line crushes Pharo, its window gets closed.
> 
> I went through the uFFI book, however I cannot find the answer.
> 
> I'm on Windows 10 x64, Pharo 7.0.4 32-bit.
> 
> Best wishes,
> Tomaz

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


More information about the Pharo-users mailing list