<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 10, 2017 at 5:05 AM, Edwin Ancaer <span dir="ltr"><<a href="mailto:eancaer@gmail.com" target="_blank">eancaer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Ben, Vaidotas, <div><br></div><div>thanks for helping me out. The version at <a href="http://smalltalkhub.com/#!/~MilanVavra/SqueakSQLite3" rel="noreferrer" style="font-size:12.8px" target="_blank">http://smalltalkhub.com/#!/<wbr>~MilanVavra/SqueakSQLite3</a></div><div>is working, but only after I added the module: parameter in the api... method definitions in the class, eg.</div><div><br></div><div><cdecl: long 'sqlite3_open' (char* SqliteReference*) <b>module: 'libsqlite3.so.0'</b>></div><div><br></div><div>I found the module: parameter <a href="http://wiki.squeak.org/squeak/2426" target="_blank">http://wiki.squeak.<wbr>org/squeak/2426</a>. </div><div>Is this new for FFI in Squeak 5, or is there still something wrong with my FFI settings?</div></div></blockquote><div><br></div><div><div>I guess it would work if you symlink <b>libsqlite3.so.0 </b>to <b>libsqlite3.so</b>, either manually or by installing the <b>sqlite3-dev</b> package. Alternatively, change SqliteLibrary class>>moduleName to return '<b>libsqlite3.so.0</b>'.</div></div><div><br></div><div><div>All FFI functions in an ExternalLibrary subclass share the class's moduleName, instead of having to declare it in every method. SqliteLibrary is an ExternalLibrary subclass, and it declares its moduleName as 'sqlite3'. That should work, since the VM adds a 'lib' prefix and a '.so' suffix (see sqUnixExternalPrims.c).</div></div><div><br></div><div>The way other FFI libraries handle this is by making the moduleName method answer different names for each platform. E.g. Nicolas' Smallapack library does this:</div><div><br></div><div><div>moduleName</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">    </span>"Return the name of the module for this library</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>this should depend on host machine"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>moduleName ifNil:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>[moduleName := self isUnix</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                             </span>ifTrue: [self unixModuleName]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                          </span>ifFalse: [self isMacOS</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                                 </span>ifTrue: [self macOsxModuleName]</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                                        </span>ifFalse: [self win32ModuleName]].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>self new forceLoading].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>^moduleName</div></div><div><br></div><div><div>unixModuleName</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span><preference: 'The name of the FORTRAN Lapack library on Unix'</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>category: 'Smallapack'</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>description: 'Check for existing liblapack-dev package.'</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>type: #String></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>^unixModuleName ifNil: [ 'liblapack.so' ]</div></div><div><br></div><div>... which allows you to change the library name as a preference. (it also mentions the liblapack-dev package, which provides the .so symlink)</div><div><br></div><div>- Bert -</div></div></div></div>