[plt-scheme] Using dlopen/loadlibrary with SWIG

From: Hans Oesterholt-Dijkema (hdnews at gawab.com)
Date: Sat Jan 21 08:03:04 EST 2006

Hi All,

I'm currently building a Gtk2 binding in mzscheme, using swig.
Previous year I've contributed a patch to swig, for using the
latest mzscheme 3.00 with SWIG.

Now, I'm in need of a feature, which I could implement in the
current mzscheme module, but may be a feature that could be
more generic for SWIG.

Instead of linking directly to dynamic libraries, I want to
to use dlopen/loadlibrary (dlsym/getprocaddress on win32)
to get function definitions from a library.

What do I need this for?

I'm creating the binding for Gtk2 based on the latest Gtk2 header
files. In older versions,  (some) functions will not be there. Instead
of getting a runtime error for functions not in the library on load
time, I'd like to get a runtime error only when accessing the function.

So when searching the needed function and getting NULL as
result, I want to throw a (scheme) error, using a callback I've
provided from mzscheme.

Would this be a general feature for SWIG or a module bound

Thanks in advance for your answers,

Hans Oesterholt-Dijkema

Posted on the users mailing list.