[squeak-dev] FFI and macOS
eliot.miranda at gmail.com
Sat Dec 15 17:05:36 UTC 2018
> On Dec 15, 2018, at 8:10 AM, JOHN SARKELA via Squeak-dev <squeak-dev at lists.squeakfoundation.org> wrote:
> I’ve been fiddling about with FFI and have some macOS questions. Things on Linux work as expected. On macOS (Mojave) I am unable to resolve a dylib.
> 1. Must the code be packaged as a bundle for FFI to find and load the code? If so, is there a standard method for wrapping the dylib?
No. Both bundles and dylibs work. I *think*, but am not sure, that bundles only work if they’re in .app/Contents/Resources but I’m not sure. The code is positively labyrinthine and not easy to read.
> 2. Does the vm respect environment LD flags?
The VM uses dlopen and hence if dlopen respects the flags do does the VM, but otherwise there is no explicitly access to those environment variables. For example LD_LIBRARY_PATH is never fetched.
> 3. Must the library be in a location that is accessible to Squeak? If so, a simple sym link does not appear to work. Does the library have special requirements as to the location in the filesystem where it resides?
I think the issue here is that the loading code does not check for or follow symlinks. I guess it should. There is a repository near you ;-). https://github.com/OpenSmalltalk/opensmalltalk-vm
> 4. A simple c program can resolve and use the library via dl* calls. Does the vm use some other mechanism for finding and loading modules? (Yes, I have been lazy and not read the vm code.)
The dl* calls are wrapped in a labyrinthine enumeration over many directory paths. I’d love to see this code rewritten to be more comprehensible. See https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/Mac%20OS/vm/sqMacUnixExternalPrims.c
> I would be most appreciative if someone could shine some light on this topic.
So would I.
> John Sarkela
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev