Creating a module system (dynamic loading) in C
dlopen is the way to go. Here are a few examples: Loading a plugin with dlopen: #include <dlfcn.h> … int main (const int argc, const char *argv[]) { char *plugin_name; char file_name[80]; void *plugin; … plugin = dlopen(file_name, RTLD_NOW); if (!plugin) { fatal(“Cannot load %s: %s”, plugin_name, dlerror ()); } Compiling the above: % cc … Read more