find-foreign-library: recommend usnig modules
"Hoehle, Joerg-Cyril" <[email protected]> Wed, 24 Apr 2002 13:05:11 +0200
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I came across some issues while working on shared libraries for CLISP:
1) I strongly encourage use of module nicknames.
http://uffi.med-info.com/manual/r1468.htm
I.e. don't say "required by Lispworks", say "recommended and makes your life easy and your work more likely to be portable".
Similarly for DEF-FUNCTION.
"Even if your system doesn't need the indication of the module from which the function originates, we recommend specifying it via the :module option to UFFI:DEF-FUNCTION, for portability."
CLISP will also require something like that for functions based on shared libraries, e.g. zlib.dll. It also has foreign functions not based on shared libraries, but on modules.
2) How to recogize cygwin? It appears as #+UNIX in CLISP, not as #+WIN32, but wants "cygz.dll" instead of "libz.so" which I suppose works across several UNIX systems (maybe only the dlopen() ones, not shl_load()), while #+WIN32 (native port, e.g. using MS-VC) wants "zlib.dll"
So even the suffix is different among #+UNIX. This works against the default of NIL in :TYPES of uffi:find-foreign-library, doesn't it?
So providing a user settable variable
(defvar *zlib-path*
(or #+WIN32 "zlib.dll"
;; TODO how to deal with cygwin (#+UNIX on MS-Windows)? -- it wants "cygz.dll"
#+UNIX "libz.so"
#+AMIGA "zlib.library"
)
"Set this variable to point to the location of the zlib library
(libz.so or zlib.dll) on your system.")
is what people are used to and maybe the best one can have. Cygwin users will have to overide this. HP-UX users probably also.
Or
(defvar uffi::*default-lib-types*
'( #+(and CLISP WIN32) "dll"
#+(and CLISP UNIX) "so"
#+(and CLISP UNIX) "dll" ; for cygwin
#+(and CLISP UNIX) xyz ; for HP-UX
... for whatever 30 systems CLISP runs on.
#+(and CLISP AMIGA) "library"
))
Problem: find-foreign-library may locate wrong library in ready-to-use binary distributions, i.e. archives which already contain both windows/zlib.dll and linux-libc6/libz.so...
Regards,
Jörg Höhle.