int DealLibFun(int var)
{
char libso[256];
int iRc;
void *handle;
int (* dlfun)();
sprintf(libso,"%s/lib/lib***.so",getenv("HOME"));
handle = (void *)dlopen(libso, RTLD_LAZY|RTLD_GLOBAL);
if(handle==NULL){
printf("%s,%d,dlopen [%s] error=[%d]%s",__FILE__,__LINE__,libso,errno,dlerror());
return(-1);
}
dlfun = (int (*)())dlsym(handle,"入口函数名");
if(dlfun==NULL){
printf("%s,%d,dlsym [%s] error=[%d][%s]",__FILE__,__LINE__,libso,errno,dlerror());
return(-1);
}
iRc=(*dlfun)(var);
dlclose(handle);
if(iRc) {
return(-1);
}
return(0);
}