[plt-scheme] Questions about modules, compilation, namespaces, planet and ffi

From: Eli Barzilay (eli at barzilay.org)
Date: Wed May 11 05:32:20 EDT 2005

On May 11, Geoffrey Knauth wrote:
> 
> > On May 11, Bruno Deferrari wrote:
> >> (require (lib "foreign.ss"))
> >> (define libpthread (ffi-lib "/lib/libpthread.so.0"))
> 
> It looks clean (2 lines) except it seems platform specific.  Is
> there a way to hide that detail?  --GSK

Well, the only platform specific bit is the path which could be
omitted -- IIUC, using

  (define libpthread (ffi-lib "libpthread"))

should work -- the Scheme side of the foreign interface will add a
".so", the operating system will then search for "libpthread.so" as
usual, which should be a symlink to libpthread.so.0.  However, on my
system this doesn't work since it finds "/usr/lib/libpthread.so" which
is a text file, but

  (define libpthread (ffi-lib "libpthread.so.0"))

does work.  (For libpthread, it might make sense to hard-wire the
version...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!



Posted on the users mailing list.