Previously with NativeBoost, Pharo FFI diverged from the mainline VM, which made support from vm-devs a bit harder. In Pharo 5 we've returned to the fold with UFFI, but there are some changes required. I recorded my own learning of UFFI here... http://blog.openinworld.com/2016/09/pharo-libclang-ffi-part-1-preamble/ cheers -ben On Tue, Dec 20, 2016 at 9:41 AM, jjjhhh <jayhardesty@gmail.com> wrote:
Hello,
I need help rescuing code that has dependencies on FFI. I just downloaded the latest Pharo 5 vm in order to run Pharo under MacOS 10.12. Now the FFI-based code in my image no longer works (or is viewable).
What worked before (for years, up through MacOS 10.11) is as follows:
I have a 32-bit lib (i386) called ThePlugin.bundle (C code compiled w/ Xcode). I put it in Pharo.app/Contents/MacOS/Contents/Plugins/.
The lib has a C function like: int someNumber() { return 123; }
In Smalltalk I have a class ThePluginFFI with the class method: someNumber <cdecl: int 'someNumber' () module: 'ThePlugin'> ^self externalCallFailed
And if I typed "ThePluginFFI someNumber" I got 123
Now I get "External module not found". If I try to view the method "someNumber" I get an MNU from RBFFLCallPragma>>selectorParts (receiver of "keywords" is nil), and the image hangs.
I tried rewriting the method someNumber to look like this: someNumber ^self ffiCall: #( int someNumber() ) module: ThePlugin uniqueInstance
where ThePlugin is a subclass of FFILibrary with an instance method: macModuleName ^'ThePlugin.bundle'
but this still gets "External module not found"
Is there some new way of doing all this? Or some new trick to loading libraries (I tried dylibs as well as bundles).
I couldn't find a recent summary/update.
Thanks for any help! Jay
-- View this message in context: http://forum.world.st/FFI-on-MacOS-10-12-using-Pharo-5-tp4927537.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.