--- Makefile all: main foobar.so main: main.c gcc main.c -export-dynamic -ldl -o main foobar.so: foobar.c gcc foobar.c -shared -o foobar.so --- foobar.c #include void foobar_run() { puts("foobar_run"); exported(); } --- main.c #include #include void exported() { puts("expoted"); } typedef void (*foonction)(void); int main(int argc, char **argv) { puts("main"); void *lib = dlopen("./foobar.so", RTLD_LOCAL | RTLD_NOW); printf("lib: %p, error: %s\n", lib, dlerror()); foonction run = dlsym(lib, "foobar_run"); printf("run: %p\n", run); run(); return 0; }