#include #include #include "common.h" int main(int argc, char **argv) { void *dll; struct s_cmd *c; void (*func)(); dll = dlopen("./module.o", RTLD_LAZY); if (!dll) { fputs(dlerror(), stderr); return -1; } c = dlsym(dll, "__exports"); if (!c) { fputs("No __exports?\n", stderr); return -1; } while (c->text) { printf("my_command = [%s]\n", c->text); c->func(); c++; } return 0; }