<div>The module is found ! How:</div>- Using VM Squeak 5.8b12 2  (instead of Cog or the VM provided in Seaside One-Click image)  <div>- go in Squeak\ 5.8b12\ 2.app/Contents/Resources/, then ln -s /usr/local/lib/libyaz.3.dylib .</div>

<div><br></div><div>Now I have the &quot;Unable to find function address&quot; you have talked earlier :) I will look at the mangled function names.</div><div><br></div><div><br></div><div>Laurent  --- on the road to the FFI mountain.</div>

<meta charset="utf-8"><div><br><br><div class="gmail_quote">On Tue, Dec 21, 2010 at 6:59 AM, Hernán Morales Durand <span dir="ltr">&lt;<a href="mailto:hernan.morales@gmail.com">hernan.morales@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Laurent,<br>
I forward this e-mail to the squeak mailing list, may be someone there<br>
have a better idea how the OSX VM works. BTW there are more<br>
commentaries here<br>
<a href="http://forum.world.st/squeak-dev-Alien-amp-Squeak-FFI-issues-on-Snow-Leopard-td85608.html" target="_blank">http://forum.world.st/squeak-dev-Alien-amp-Squeak-FFI-issues-on-Snow-Leopard-td85608.html</a><br>
<div><div></div><div class="h5">Cheers,<br>
<br>
Hernán<br>
<br>
2010/12/20 laurent laffont &lt;<a href="mailto:laurent.laffont@gmail.com">laurent.laffont@gmail.com</a>&gt;:<br>
&gt; Hi Hernan,<br>
&gt; the strace equivalent on OSX seems to be dtruss (yes I&#39;m learning OSX too :)<br>
&gt; sudo dtruss -p [pid of process]<br>
&gt; in the trace I have this:<br>
&gt; stat(&quot;/Users/laurentlaffont/Downloads/Seaside.app/Contents/Resources/yaz3.bundle/Contents/MacOS/yaz3\0&quot;,<br>
&gt; 0xBFF59440, 0xBFF5AB28) = -1 Err#2<br>
&gt; stat64(&quot;/Users/laurentlaffont/Downloads/Seaside.app/Contents/Resources/yaz3.bundle/Contents/MacOS/yaz3\0&quot;,<br>
&gt; 0xBFF5892C, 0xBFF5AB28) = -1 Err#2<br>
&gt; stat(&quot;/Users/laurentlaffont/Downloads/Seaside.app/Contents/Resources/yaz3\0&quot;,<br>
&gt; 0xBFF59440, 0xBFF5AB28) = 0 0<br>
&gt; stat64(&quot;/Users/laurentlaffont/Downloads/Seaside.app/Contents/Resources/yaz3\0&quot;,<br>
&gt; 0xBFF5892C, 0xBFF5AB28) = 0 0<br>
&gt; open(&quot;/Users/laurentlaffont/Downloads/Seaside.app/Contents/Resources/yaz3\0&quot;,<br>
&gt; 0x0, 0x0) = 12 0<br>
&gt; pread(0xC, &quot;\317\372\355\376\a\0&quot;, 0x1000, 0x0) = 4096 0<br>
&gt; close(0xC) = 0 0<br>
&gt; stat(&quot;/Users/laurentlaffont/Downloads/Plugins/yaz3.bundle/Contents/MacOS/yaz3\0&quot;,<br>
&gt; 0xBFF59440, 0x1000) = -1 Err#2<br>
&gt; stat64(&quot;/Users/laurentlaffont/Downloads/Plugins/yaz3.bundle/Contents/MacOS/yaz3\0&quot;,<br>
&gt; 0xBFF5892C, 0x1000) = -1 Err#2<br>
&gt; stat(&quot;/Users/laurentlaffont/Downloads/Plugins/yaz3\0&quot;, 0xBFF59440, 0x1000) =<br>
&gt; -1 Err#2<br>
&gt; stat64(&quot;/Users/laurentlaffont/Downloads/Plugins/yaz3\0&quot;, 0xBFF5892C, 0x1000)<br>
&gt; = -1 Err#2<br>
&gt;<br>
&gt; so it looks like the VM is trying to find yaz3 at non standard Unix places<br>
&gt; (I don&#39;t know if it&#39;s SqueakVM or OSX related).<br>
&gt; I&#39;ve created Contents/Resources/yaz3.bundle/Contents/MacOS/, put yaz lib<br>
&gt; there, ln -s libyaz.3.dylib yaz3 but no success.<br>
&gt;<br>
&gt; I&#39;ve read good post <a href="http://forum.world.st/FFI-Documentation-td2225150.html" target="_blank">http://forum.world.st/FFI-Documentation-td2225150.html</a> :<br>
&gt;<br>
&gt; Module Location - where the external library file lives<br>
&gt;       - depends on the platform<br>
&gt;               - Mac<br>
&gt;                       - pre Snow Leopard<br>
&gt;                               - checks VM path and common library paths<br>
&gt;                       - Snow Leopard<br>
&gt;                               - only looks in VM bundle&#39;s Resources file, you must either [5]:<br>
&gt;                                       - store all external libraries there<br>
&gt;                                       - ln -s path/to/library path/to/VM/Resources/library_name<br>
&gt;                                       - Change the VM&#39;s Info.plist &quot;SqueakPluginsBuiltInOrLocalOnly&quot; key from<br>
&gt; &quot;true&quot; to &quot;false.&quot;<br>
&gt;<br>
&gt; For this SqueakPluginsBuiltInOrLocalOnly I suppose I need to compile a VM ?<br>
&gt; Cheers,<br>
&gt; Laurent Laffont<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Dec 20, 2010 at 4:12 PM, Hernán Morales Durand<br>
&gt; &lt;<a href="mailto:hernan.morales@gmail.com">hernan.morales@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Laurent<br>
&gt;&gt;<br>
&gt;&gt; I&#39;ve read there is a couple of system calll monitors in MacOS, ktrace<br>
&gt;&gt; and dtrace (<a href="http://en.wikipedia.org/wiki/Ktrace" target="_blank">http://en.wikipedia.org/wiki/Ktrace</a> ,<br>
&gt;&gt; <a href="http://en.wikipedia.org/wiki/DTrace" target="_blank">http://en.wikipedia.org/wiki/DTrace</a>) so you may attach to the VM and<br>
&gt;&gt; see what&#39;s missing?<br>
&gt;&gt; Cheers,<br>
&gt;&gt;<br>
&gt;&gt; Hernán<br>
&gt;&gt;<br>
&gt;&gt; 2010/12/20 laurent laffont &lt;<a href="mailto:laurent.laffont@gmail.com">laurent.laffont@gmail.com</a>&gt;:<br>
&gt;&gt; &gt; Thanks Hernan.<br>
&gt;&gt; &gt; It still doesn&#39;t work. I&#39;ve also tried to play with LD_LOAD_PATH /<br>
&gt;&gt; &gt; LD_LIBRARY_PATH no success.... I want to make it work so I need to learn<br>
&gt;&gt; &gt; :)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; For the mangled function names, on Linux and OSX there&#39;s nm.<br>
&gt;&gt; &gt; Here&#39;s what I get:<br>
&gt;&gt; &gt; $ nm -g libyaz.3.dylib | grep ZOOM_connection_create<br>
&gt;&gt; &gt; 0000000000046a30 T _ZOOM_connection_create<br>
&gt;&gt; &gt; Cheers,<br>
&gt;&gt; &gt; Laurent<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Sun, Dec 19, 2010 at 6:23 PM, Hernán Morales Durand<br>
&gt;&gt; &gt; &lt;<a href="mailto:hernan.morales@gmail.com">hernan.morales@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Hi Laurent,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks for reporting. The correct #moduleName for MacOS was missing,<br>
&gt;&gt; &gt;&gt; I&#39;ve uploaded a new version answering &#39;libyaz.3.dylib&#39; which I guess<br>
&gt;&gt; &gt;&gt; is the corresponding for &#39;yaz3.dll&#39; (according to<br>
&gt;&gt; &gt;&gt; <a href="http://en.wikipedia.org/wiki/Dynamic_library#Naming" target="_blank">http://en.wikipedia.org/wiki/Dynamic_library#Naming</a> ).<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I haven&#39;t access to a MacOS, but in Windows I&#39;ve had to find the<br>
&gt;&gt; &gt;&gt; mangled function names (i.e. _ZOOM_connection_create@4) so FFI can<br>
&gt;&gt; &gt;&gt; find the function addresses and you don&#39;t get the classic &quot;Error:<br>
&gt;&gt; &gt;&gt; Unable to find function address&quot;. I don&#39;t know if it&#39;s related since<br>
&gt;&gt; &gt;&gt; talks about C++, but you may want to check<br>
&gt;&gt; &gt;&gt; <a href="http://wiki.squeak.org/squeak/3735" target="_blank">http://wiki.squeak.org/squeak/3735</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; The tool I&#39;ve used to find the mangled function names in Windows is<br>
&gt;&gt; &gt;&gt; the Steve Miller&#39;s Dependency Walker <a href="http://www.dependencywalker.com/" target="_blank">http://www.dependencywalker.com/</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; 2010/12/19 laurent laffont &lt;<a href="mailto:laurent.laffont@gmail.com">laurent.laffont@gmail.com</a>&gt;:<br>
&gt;&gt; &gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I want to use <a href="http://www.squeaksource.com/Z3950" target="_blank">http://www.squeaksource.com/Z3950</a><br>
&gt;&gt; &gt;&gt; &gt; Following install instructions, I&#39;ve dowloaded yaz sources (I&#39;ve<br>
&gt;&gt; &gt;&gt; &gt; tried<br>
&gt;&gt; &gt;&gt; &gt; 4.1.2<br>
&gt;&gt; &gt;&gt; &gt; and 3.0.52) as it seems there&#39;s no binary for OSX, ./configure<br>
&gt;&gt; &gt;&gt; &gt; &amp;&amp; make<br>
&gt;&gt; &gt;&gt; &gt; &amp;&amp;<br>
&gt;&gt; &gt;&gt; &gt; make install.<br>
&gt;&gt; &gt;&gt; &gt; Then using latest Seaside One Click image I&#39;ve copied<br>
&gt;&gt; &gt;&gt; &gt; /usr/local/lib/*yaz*<br>
&gt;&gt; &gt;&gt; &gt;  in Seaside.app/Contents/MacOS<br>
&gt;&gt; &gt;&gt; &gt; $ ls ~/Downloads/Seaside.app/Contents/MacOS/<br>
&gt;&gt; &gt;&gt; &gt; Squeak VM Opt         libyaz.a              <a href="http://libyaz.la" target="_blank">libyaz.la</a><br>
&gt;&gt; &gt;&gt; &gt; libyaz_icu.a          <a href="http://libyaz_icu.la" target="_blank">libyaz_icu.la</a>         libyaz_server.a<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://libyaz_server.la" target="_blank">libyaz_server.la</a> libyaz.3.dylib        libyaz.dylib<br>
&gt;&gt; &gt;&gt; &gt;  libyaz_icu.3.dylib    libyaz_icu.dylib      libyaz_server.3.dylib<br>
&gt;&gt; &gt;&gt; &gt; libyaz_server.dylib<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; But then I have a External Module Not Found on<br>
&gt;&gt; &gt;&gt; &gt; YAZPQFFFILibrary&gt;&gt;createParser<br>
&gt;&gt; &gt;&gt; &gt; &quot; YAZPQDFFILibrary default createParser &quot;<br>
&gt;&gt; &gt;&gt; &gt; &lt;cdecl: YAZPQFParser &#39;yaz_pqf_create&#39; (void) module: &#39;yaz3&#39;&gt;<br>
&gt;&gt; &gt;&gt; &gt; ^ self externalCallFailed<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Any hint ?<br>
&gt;&gt; &gt;&gt; &gt; Cheers,<br>
&gt;&gt; &gt;&gt; &gt; Laurent Laffont -- FFI newbie<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Pharo Smalltalk Screencasts: <a href="http://www.pharocasts.com/" target="_blank">http://www.pharocasts.com/</a><br>
&gt;&gt; &gt;&gt; &gt; Blog: <a href="http://magaloma.blogspot.com/" target="_blank">http://magaloma.blogspot.com/</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Hernán Morales<br>
&gt;&gt; &gt;&gt; Information Technology Manager,<br>
&gt;&gt; &gt;&gt; Institute of Veterinary Genetics.<br>
&gt;&gt; &gt;&gt; National Scientific and Technical Research Council (CONICET).<br>
&gt;&gt; &gt;&gt; La Plata (1900), Buenos Aires, Argentina.<br>
&gt;&gt; &gt;&gt; Telephone: +54 (0221) 421-1799.<br>
&gt;&gt; &gt;&gt; Internal: 422<br>
&gt;&gt; &gt;&gt; Fax: 425-7980 or 421-1799.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>