SASC
DVBSoftCAM

cScDlls Class Reference

Inheritance diagram for cScDlls:

List of all members.

Public Member Functions

 cScDlls (void)
 ~cScDlls ()
bool Load (void)
 cScDlls (void)
 ~cScDlls ()
bool Load (void)

Detailed Description

Definition at line 1110 of file sc.c.


Constructor & Destructor Documentation

cScDlls::cScDlls ( void  )

Definition at line 1119 of file sc.c.

{
  handle=0;
}
cScDlls::~cScDlls ( )

Definition at line 1124 of file sc.c.

References cSimpleListBase::Clear(), dlclose(), L_CORE_DYN, and PRINTF.

{
  Clear();
  if(handle) dlclose(handle);
  PRINTF(L_CORE_DYN,"unload done");
}
cScDlls::cScDlls ( void  )
cScDlls::~cScDlls ( )

Member Function Documentation

bool cScDlls::Load ( void  )

Definition at line 1131 of file sc.c.

References AddDirectory(), APIVERSION, dladdr(), dlerror(), dlopen(), free, info, cSimpleListBase::Ins(), L_CORE_DYN, L_GEN_ERROR, L_GEN_INFO, LIBSC_PREFIX, LIBVDR_PREFIX, cScDll::Load(), cReadDir::Next(), PRINTF, SCAPIVERS, and SO_INDICATOR.

Referenced by cScPlugin::cScPlugin().

{
  Dl_info info;
  static int marker=0;
  if(!dladdr((void *)&marker,&info)) {
    PRINTF(L_GEN_ERROR,"dladdr: %s",dlerror());
    return false;
    }

  // we have to re-dlopen our selfs as VDR doesn't use RTLD_GLOBAL
  // but our symbols have to be available to the sub libs.
  handle=dlopen(info.dli_fname,RTLD_NOW|RTLD_GLOBAL);
  if(!handle) {
    PRINTF(L_GEN_ERROR,"dlopen myself: %s",dlerror());
    return false;
    }

  char *path=strdup(info.dli_fname);
  char *p;
  if((p=rindex(path,'/'))) *p=0;
  PRINTF(L_CORE_DYN,"library path %sn",path);

  char pat[64];
#if APIVERSNUM >= 10711
#ifdef WITH_SDDVB
  {
  snprintf(pat,sizeof(pat),"%s%s%s%s",LIBVDR_PREFIX,"dvbsddevice",SO_INDICATOR,APIVERSION);
  cScDll *dll=new cScDll(AddDirectory(path,pat));
  if(dll) {
    if(dll->Load(false)) {
      PRINTF(L_GEN_INFO,"VDR dvbsddevice plugin loaded as subplugin");
      }
    Ins(dll);
    }
  }
#endif //WITH_SDDVB
#ifdef WITH_HDDVB
  {
  snprintf(pat,sizeof(pat),"%s%s%s%s",LIBVDR_PREFIX,"dvbhddevice",SO_INDICATOR,APIVERSION);
  cScDll *dll=new cScDll(AddDirectory(path,pat));
  if(dll) {
    if(dll->Load(false)) {
      PRINTF(L_GEN_INFO,"VDR dvbhddevice plugin loaded as subplugin");
      }
    Ins(dll);
    }
  }
#endif //WITH_HDDVB
#endif //APIVERSNUM >= 10711

  snprintf(pat,sizeof(pat),"%s*-%d%s%s",LIBSC_PREFIX,SCAPIVERS,SO_INDICATOR,APIVERSION);
  bool res=true;
  cReadDir dir(path);
  struct dirent *e;
  while((e=dir.Next())) {
    if(!fnmatch(pat,e->d_name,FNM_PATHNAME|FNM_NOESCAPE)) {
      cScDll *dll=new cScDll(AddDirectory(path,e->d_name));
      if(dll) {
        if(!dll->Load(true)) res=false;
        Ins(dll);
        }
      }
    }
  free(path);
  return res;
}
bool cScDlls::Load ( void  )

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines