Runtime loading

Maxime Henrion mux at freebsd.org
Thu Sep 9 07:36:22 PDT 2004


db wrote:
> Hi all
> 
> In my C++ program I need to load some files/classes at runtime, so that users 
> can add "plugins" without recompilling my program. What functions should I 
> use? I'm using FreeBSD 5.3-beta2 btw.

I'm not sure about C++, though I guess you could use the same functions as
in C.  If that's true, then you should use the dlopen() family of functions.
They are quite portable, since you'll find the same functions under all the
*BSD, Linux and Solaris.  Be aware that with Linux and Solaris, those
functions are located in libdl, while they are found in libc on the *BSD
systems.

Cheers,
Maxime


More information about the freebsd-hackers mailing list