MacOS X FFI Issues
Last updated at 2:08 am UTC on 17 May 2010
Under Snow Leopard:
As of 5/16/2010, the Mac VM's default behavior is to only look its Resources folder for libraries.
The two workarounds are (see http://forum.world.st/squeak-dev-Alien-Squeak-FFI-issues-on-Snow-Leopard-td85608.html#a2218782 for tradeoffs):
- Create links to external libraries called by FFI via: ln -s /path/to/library.file [VM file name].app/Resources/library.file (e.g. ln -s /usr/lib/libc.dylib [VM file name].app/Resources/libc.dylib ).
- If you do this, primitive calls must match the module name exactly to the link's filename, including extension (e.g. , not <...module: 'c'>
- Change the VM's Info.plist "SqueakPluginsBuiltInOrLocalOnly" key from "true" to "false."
Pre 3.8.12 carbon VM for MacOS X (supported by John McIntosh):
These older VMs do not support the Mach-o dynamic libraries (.dylib) with the FFI.
You must either build a bundle or a framework, or it will give an "Unable To Find Function Address" exception if you try to use a dylib.
- In the 3.8.12 series of carbon VMs, this was changed, we now use the standard unix load logic taken from the unix vm, to load various types of unix librarys/object files/etc and frameworks. In fact in Sophie we use many operating system support frameworks, like the file dialogs via FFI calls to the supporting frameworks.