Hi, 

I never tested it with a “bundle” plugin. But if before it worked like this: 

someNumber 
       <cdecl: int 'someNumber' () module: 'ThePlugin'>
       ^self externalCallFailed 

Now it should work like this:

someNumber 
        ^ self ffiCall: #(int someNumber () ) module: ‘ThePlugin’.

and: 

a) you can do that with a FFILibrary child, in which case it will be something 
like this: 

ThePlugin>>macModuleName
        ^ ‘ThePlugin'

someNumber 
        ^ self ffiCall: #(int someNumber () ) module: ThePlugin. “Class 
reference, no need to put uniqueInstance”

b) bundles needs to be put where bundles go: Pharo.app/Contents/Resources

cheers, 
Esteban


> On 20 Dec 2016, at 02:41, 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