[racket] policy on providing version for ffi-lib

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Mon May 2 19:20:54 EDT 2011

I notice that Sqlite's library is usually installed as
'libsqlite3.so.0' on a user's system, but the sqlite PLaneT package:

    http://planet.racket-lang.org/display.ss?package=sqlite.plt&owner=jaymccarthy

appears to assume that the library is named libsqlite3.so.  J G Cho
ran across this a week or so ago
(http://www.mail-archive.com/users@racket-lang.org/msg05318.html)  and
I ran across the same issue this afternoon.


I guess it's easy to "fix" this by creating a dynamic link, but I
don't think this is the right solution.  According to section 3.1.1 of
the Program Library HOWTO:

    http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

the expectation is that FFI library writers should be linking to the
"soname", not the "linker" name.  To fix this for the sqllite bindings
in particular, the call to ffi-lib in the bindings file
("sqllite-ffi.rkt") needs to provide the version number, from

    (define sqlite (ffi-lib "libsqlite3"))

to:

    (define sqlite (ffi-lib "libsqlite3" "0"))



The default policy for ffi-lib, however, is to use the linker name
convention if no second argument is passed to ffi-lib:

    http://docs.racket-lang.org/foreign/Loading_Foreign_Libraries.html#(def._((lib._ffi/unsafe..rkt)._ffi-lib))

which seems to encourage this confusion.  Can the documentation to
ffi-lib be revised to more vigorously encourage the use of the version
argument?


Posted on the users mailing list.