#include int main() { void *handle; void (*fun)(); #ifdef DO_RTLD_LAZY handle = dlopen("./my_lib.so", RTLD_LAZY); #else handle = dlopen("./my_lib.so", RTLD_NOW); #endif fun = dlsym(handle, "lib_fun"); (*fun)(); return 0; }