代码示例:
#include <stdio.h> #include <stdlib.h> #include <dlfcn.h> typedef int(*Func)(void*); int callFunc(dtInterp_t a) { void* handle = dlopen("*.so", RTLD_LAZY); Func func = (Func)dlsym(handle, "funcName"); func(a); dlclose(handle); return 0; }
代码示例:
#include <stdio.h> #include <stdlib.h> #include <dlfcn.h> typedef int(*Func)(void*); int callFunc(dtInterp_t a) { void* handle = dlopen("*.so", RTLD_LAZY); Func func = (Func)dlsym(handle, "funcName"); func(a); dlclose(handle); return 0; }