I recently worked with UFFI for making a shared memory library, the very
first thing I have done is to do everything first with C code , to make
sure things work at the C side. Its so easy to mess up things at C code. So
first make sure that the library actually works, because if it does not
work inside a C program it wont work with UFFI either.

The library may have to be rebuilt in Sierra , I think Sierra changed
several things so just because the library worked on El Capitan does not
mean it will work on Sierra. This is why its paramount you test the library
inside a C application.

Another thing is to make sure UFFI can locate the library , there is LibC
class inside the Pharo image that gives an example on how to add paths that
UFFI will search to find the library, I think its the linux side of the
class but it should work the same on MacOS too.

Last but not least I am not sure a bundle would work with UFFI but once
more testing this with C code is the safest way to locate the problem.

Old FFIs still work in Pharo 6 because there are things that UFFI cannot do
like call Objective C libraries. So I doubt your problem is UFFI related
most likely you need to build the library for Sierra.

On Tue, Dec 20, 2016 at 3:57 AM jjjhhh <jayharde...@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.
>
>

Reply via email to