|
SASC-NG
DVBSoftCAM
|
Inheritance diagram for cScDll:Public Member Functions | |
| cScDll (const char *FileName) | |
| ~cScDll () | |
| bool | Load (bool check) |
| cScDll::cScDll | ( | const char * | FileName | ) |
| cScDll::~cScDll | ( | ) |
| bool cScDll::Load | ( | bool | check | ) |
Definition at line 1084 of file sc.c.
References dlerror(), dlopen(), dlsym(), L_CORE_DYN, L_GEN_ERROR, PRINTF, and SCAPIVERS.
Referenced by cScDlls::Load().
{
char *base=rindex(fileName,'/');
if(base) base++; else base=fileName;
PRINTF(L_CORE_DYN,"loading library: %s",base);
if(!handle) {
handle=dlopen(fileName,RTLD_NOW|(check?RTLD_LOCAL:RTLD_GLOBAL));
if(handle) {
if(!check) return true;
dlerror();
int *libapivers=(int *)dlsym(handle,"ScLibApiVersion");
const char *error=dlerror();
if(!error && *libapivers==SCAPIVERS) return true;
else PRINTF(L_GEN_ERROR,"dload: %s: SCAPI version doesn't match (plugin=%d, library=%d)",base,SCAPIVERS,!error?*libapivers:0);
}
else PRINTF(L_GEN_ERROR,"dload: %s: %s",base,dlerror());
}
return false;
}