Subject: [clisp-list] two interfaces to dynamic loading of libraries/objects

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Thu Apr 4 05:57:10 2002

Hi,

Reini Urban wrote:
> and the dynamic CLISP FFI should also be doable. (truly a shame)
It could be here by the end of the day...

I'd appreciate comments upon two different wrappers around all siblings
of dlopen() functionality: sysdll.c and dynaload.c.
http://xarch.tu-graz.ac.at/autocad/lsp_tools/ntemacs/emodules/dynaload/

The goal is to know which of these two files best suits the many
platforms that CLISP already runs on.

Reini Urban's ffis.html says "Other OS's name this function dlopen
(Sun, BSD), dld_link (GNU, linux, ...), shl_load on HPUX, rld_load on
NEXT, or use different calls (ldopen, ... on AIX;
lib$find_image_symbol on VMS)".

So I figured out I'd rather use some tiny portability layer instead of
rewriting tons of #ifdef VAX|LINUX|AmigaOS|WIN32|BSD|SYSV|BEOS myself.

Reini Urban sent me these files. Thanks Reini!

My initial comments:

o sysdll.[ch] (William Perry) is usable as is, while dynaload.c (Steve
Kemp) contains Emacs code at the end.

o dynaload.c seems to support more platforms (mentions AIX, BEOS
etc.). I don't know if CLISP runs on all of these.

o sysdll.c provides empty default stubs. While this maybe fine for
XEmacs where they want the thing to compile, this is *not* acceptable
for CLISP. I don't want :DYNAMIC-FFI to be pushed on *features* when
the user will get "no dlopen" at run-time, although it could have been
known at CLISP compile-time that the functionality is not there for
this platform.  Removing the empty stubs would help generate a C
compiler error, but this would mean a different file from the original
one.

Reini's comment in http://xarch.tu-graz.ac.at/autocad/lisp/ffis.html
"the wheel was reinvented [...] (and IMHO worse) dynaloader."

Many comments appreciated.
	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Thu Apr 4 06:39:28 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] two interfaces to dynamic loading of libraries/objects"
> * Sent on Thu, 4 Apr 2002 15:56:22 +0200
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>

IIUC, libltdl (part of GNU libtool) is exactly that:

This is GNU libltdl, a system independent dlopen wrapper for GNU libtool.

It supports the following dlopen interfaces:
* dlopen (Solaris, Linux and various BSD flavors)
* shl_load (HP-UX)
* LoadLibrary (Win16 and Win32)
* load_add_on (BeOS)
* GNU DLD (emulates dynamic linking for static libraries)
* libtool's dlpreopen

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
My inferiority complex is the only thing I can be proud of.