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@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