<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi John!!<div dir="ltr"><br>On Dec 15, 2018, at 8:10 AM, JOHN SARKELA via Squeak-dev <<a href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr"><span>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.</span><br><span></span><br><span>Questions:</span><br><span>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?</span><br></div></blockquote><div><br></div>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.<div><br><blockquote type="cite"><div dir="ltr"><span>2. Does the vm respect environment LD flags?</span><br></div></blockquote><div><br></div>The VM uses dlopen and hence if dlopen respects the flags do does the VM, but otherwise there is no explicitly access to those <span style="background-color: rgba(255, 255, 255, 0);">environment </span>variables.  For example LD_LIBRARY_PATH is never fetched.</div><div><br><blockquote type="cite"><div dir="ltr"><span>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?</span><br></div></blockquote><div><br></div>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 ;-). <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm">https://github.com/OpenSmalltalk/opensmalltalk-vm</a></div><div><br><blockquote type="cite"><div dir="ltr"><span>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.)</span><br></div></blockquote><div><br></div>The dl* calls are wrapped in a<span style="background-color: rgba(255, 255, 255, 0);"> labyrinthine enumeration over many directory paths.  I’d love to see this code rewritten to be more comprehensible.  See </span><a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/Mac%20OS/vm/sqMacUnixExternalPrims.c">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/Mac%20OS/vm/sqMacUnixExternalPrims.c</a></div><div><br><blockquote type="cite"><div dir="ltr"><span></span><span>I would be most appreciative if someone could shine some light on this topic. </span><br></div></blockquote><div><br></div>So would I.</div><div><br><blockquote type="cite"><div dir="ltr"><span></span><span>John Sarkela</span><br></div></blockquote></div></body></html>