5. Frequently Asked Questions

5.1. I'm using Windows and I can't find the dlfcn.h header file! What's the problem?
5.2. Is there some kind of dlopen-compatible wrapper for the Windows LoadLibrary API?

5.1.

I'm using Windows and I can't find the dlfcn.h header file! What's the problem?

The problem is that Windows doesn't have the dlopen API, and thus there is no dlfcn.h header. There is a similar API around the LoadLibrary function, and most of what is written here applies to it, too. Please refer to the Microsoft Developer Network Website for more information.

5.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.

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.