Finding module names to call libc functions using FFI

Ned Konz ned at squeakland.org
Thu Mar 3 20:44:43 UTC 2005


I've made UnixShell as a subclass of ExternalObject.

It has one method:

system: aString
 <cdecl: long 'system' (char *) module: 'c.so.6'>
 ^self externalCallFailed.


This works fine. HOWEVER... note the 'c.so.6'. This refers to /lib/libc.so.6, 
which is a symlink to another .so file in /lib. These arguments work fine 
too:

'libc.so.6'
'/lib/libc.so.6'

But I'd really like to use just 'c' or 'libc' instead, because (obviously) the 
version of the .so file on my system may not be the named the same as yours.

I have also tried (without success):
* using '' as a module name (hoping to get the version linked into my Squeak 
executable, if any)
* using the full name of my Squeak VM
* making an ExternalLibraryFunction with a nil module

Does anyone know a more universal way to get this information? Lookup table 
keyed by platform name (ick)?

Thanks,
-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list