On Tue, May 4, 2010 at 4:46 PM, David Wilson
<[hidden email]> wrote:
Hi
I'm new to Pharo (although I was a Smalltalk programmer in the 90's), and I'm trying to use FFI to access an MacOs system function:
Hi and welcome!
apiKLGetKeyboardLayoutCount
< cdecl: ulong 'KLGetKeyboardLayoutCount' (void) module: 'keyboards'>
^ self externalCallFailed.
I get an error "'Unable to find function address'" which seems to say the OS-module "keyboards" can't be found.
Exactly. That's the problem.
I can't figure out what the address should be.
The function is defined here: http://developer.apple.com/legacy/mac/library/documentation/Carbon/Reference/KeyboardLayoutServices/Reference/reference.html
(yes, it's deprecated, I have a very old mac runnning 10.4).
But you see the library in your computer, isn't it ? I mean, it is there, but FFI doesn't find it ?
I'm not sure if I'm using FFI correctly, do I have to somehow include the external library in the Pharo VM?
No, you shouldn't need to do that. However, you can try to put them there just to see if that's the problem. I think that at some point (depends on an order) the library is searched in the same place where you are calling from. So, yes, do a test, but just a test. It should work without doing that.
How did you install FFI ? Which Pharo VM and image versions are you using ?
Can anyone help?
I would like too, but I don't have such library.
I developed a wrapper for a Clibrary called OpenDBX using FFI. In our website, some people experimented similar problems.
Please take a look to the title "Problems with Mac OS:" of the following link:
http://www.squeakdbx.org/Compiling%20and%20installing%20OpenDBX I also cc'ed people that can help you.
Cheers
Mariano
I'm looked for FFI examples, but don't find anything helpful.
David
_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project