dynamic linking loader
dlopen
函数原型
void *dlopen(const char *filename, int flag);
dlerror
函数原型
char *dlerror(void);
dlsym
函数原型
void *dlsym(void *handle, const char *symbol);
dlclose
函数原型
int dlclose(void *handle);
写道
Since the value of the symbol could actually be NULL (so that a NULL return from dlsym() need not indicate an error), the correct way to test for an error is to call dlerror() to clear any old error conditions, then call dlsym(), and then call dlerror() again, saving its return value into a variable, and check whether this saved value is not NULL.