4.1.
I'm using Windows and I can't find the
dlfcn.h
header file on my PC! What's
the problem?
The problem is, as usual, Windows. There is no
dlfcn.h
header on Windows,and there is
no
dlopen
API. There is a similar API
around the
LoadLibrary
function, and
most of what is written here applies to it, too.
Alternatively, you can use libltdl (included in libtool) to
"emulate"
dlopen
on a
variety of platforms.
You should also read section 4,
"Dynamically
Loaded (DL) Libraries"
, of the
Program Library
HOWTO
for more techniques to load libraries and
create classes independently of your platform.
4.2.
Is there some kind of
dlopen
-compatible
wrapper for the Windows
LoadLibrary
API?
I don't know of any, and I don't think there'll ever be one
supporting all of
dlopen
's options.
There are alternatives though: libtltdl (a part of libtool),
which wraps a variety of different dynamic loading APIs, among
others
dlopen
and
LoadLibrary
. Another one is the
Dynamic
Module Loading functionality of GLib
. You can use one
of these to ensure better possible cross-platform compatibility.
I've never used any of them, so I can't tell you how stable they
are and whether they really work.