当前位置: 首页>>代码示例>>C++>>正文


C++ LibraryLoader类代码示例

本文整理汇总了C++中LibraryLoader的典型用法代码示例。如果您正苦于以下问题:C++ LibraryLoader类的具体用法?C++ LibraryLoader怎么用?C++ LibraryLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LibraryLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadDll

LibraryLoader* DllLoaderContainer::LoadDll(const char* sName, bool bLoadSymbols)
{

#ifdef LOGALL
  CLog::Log(LOGDEBUG, "Loading dll %s", sName);
#endif

  LibraryLoader* pLoader;
#ifdef _LINUX
  if (strstr(sName, ".so") != NULL || strstr(sName, ".vis") != NULL || strstr(sName, ".xbs") != NULL
      || strstr(sName, ".mvis") != NULL || strstr(sName, ".dylib") != NULL || strstr(sName, ".framework") != NULL || strstr(sName, ".pvr") != NULL)
    pLoader = new SoLoader(sName, bLoadSymbols);
  else
#elif defined(_WIN32)
  if (1)
    pLoader = new Win32DllLoader(sName);
  else
#endif
    pLoader = new DllLoader(sName, m_bTrack, false, bLoadSymbols);

  if (!pLoader)
  {
    CLog::Log(LOGERROR, "Unable to create dll %s", sName);
    return NULL;
  }

  if (!pLoader->Load())
  {
    delete pLoader;
    return NULL;
  }

  return pLoader;
}
开发者ID:herrJones,项目名称:xbmc,代码行数:34,代码来源:DllLoaderContainer.cpp

示例2: LOGDEBUG

//to do
LibraryLoader* LoaderContainer::LoadDll(const char* sName, bool bLoadSymbols)
{

#ifdef LOGALL
	LOGDEBUG("Loading dll %s", sName);
#endif

	LibraryLoader* pLoader = new Win32DllLoader(sName);

	if (!pLoader) 
	{
		LOGERR("Unable to create dll %s", sName);
		return NULL;
	}

	if (!pLoader->Load()) 
	{
		delete pLoader;
		return NULL;
	}
#ifdef LOGALL
	LOGDEBUG("Dll %s has been succesfully loaded.", sName);
#endif
	return pLoader;
}
开发者ID:mrxordi,项目名称:XRFramework,代码行数:26,代码来源:LoaderContainer.cpp

示例3: dllGetModuleHandleA

extern "C" HMODULE WINAPI dllGetModuleHandleA(LPCSTR lpModuleName)
{
  /*
  If the file name extension is omitted, the default library extension .dll is appended.
  The file name string can include a trailing point character (.) to indicate that the module name has no extension.
  The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/).
  The name is compared (case independently)
  If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).
  */

  if( lpModuleName == NULL )
    return NULL;

  char* strModuleName = new char[strlen(lpModuleName) + 5];
  strcpy(strModuleName, lpModuleName);

  if (strrchr(strModuleName, '.') == 0) strcat(strModuleName, ".dll");

  //CLog::Log(LOGDEBUG, "GetModuleHandleA(%s) .. looking up", lpModuleName);

  LibraryLoader *p = DllLoaderContainer::GetModule(strModuleName);
  delete []strModuleName;

  if (p)
  {
    //CLog::Log(LOGDEBUG, "GetModuleHandleA('%s') => 0x%x", lpModuleName, h);
    return (HMODULE)p->GetHModule();
  }

  CLog::Log(LOGDEBUG, "GetModuleHandleA('%s') failed", lpModuleName);
  return NULL;
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:32,代码来源:dll.cpp

示例4: GetModuleHandleW

bool Win32DllLoader::NeedsHooking(const char *dllName)
{
  LibraryLoader *loader = DllLoaderContainer::GetModule(dllName);
  if (loader)
  {
    // may have hooked this already (we can have repeats in the import table)
    for (unsigned int i = 0; i < m_referencedDlls.size(); i++)
    {
      if (loader->GetHModule() == m_referencedDlls[i])
        return false;
    }
  }
  std::wstring strdllNameW;
  g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(dllName), strdllNameW, false);
  HMODULE hModule = GetModuleHandleW(strdllNameW.c_str());
  if (hModule == NULL)
    return false;

  wchar_t filepathW[MAX_PATH];
  GetModuleFileNameW(hModule, filepathW, MAX_PATH);
  std::string dllPath;
  g_charsetConverter.wToUTF8(filepathW, dllPath);

  // compare this filepath with some special directories
  std::string xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc");
  std::string homePath = CSpecialProtocol::TranslatePath("special://home");
  std::string tempPath = CSpecialProtocol::TranslatePath("special://temp");
  return (StringUtils::StartsWith(dllPath, xbmcPath) ||
          StringUtils::StartsWith(dllPath, homePath) ||
          StringUtils::StartsWith(dllPath, tempPath));
}
开发者ID:krattai,项目名称:sht_tv,代码行数:31,代码来源:Win32DllLoader.cpp

示例5: GetModuleHandleW

bool Win32DllLoader::NeedsHooking(const char *dllName)
{
  LibraryLoader *loader = DllLoaderContainer::GetModule(dllName);
  if (loader)
  {
    // may have hooked this already (we can have repeats in the import table)
    for (unsigned int i = 0; i < m_referencedDlls.size(); i++)
    {
      if (loader->GetHModule() == m_referencedDlls[i])
        return false;
    }
  }
  CStdStringW strdllNameW;
  g_charsetConverter.utf8ToW(_P(dllName), strdllNameW, false);
  HMODULE hModule = GetModuleHandleW(strdllNameW.c_str());
  wchar_t filepathW[MAX_PATH];
  GetModuleFileNameW(hModule, filepathW, MAX_PATH);
  CStdString dllPath;
  g_charsetConverter.wToUTF8(filepathW, dllPath);

  // compare this filepath with some special directories
  CStdString xbmcPath = _P("special://xbmc");
  CStdString homePath = _P("special://home");
  CStdString tempPath = _P("special://temp");
  return ((strncmp(xbmcPath.c_str(), dllPath.c_str(), xbmcPath.GetLength()) == 0) ||
    (strncmp(homePath.c_str(), dllPath.c_str(), homePath.GetLength()) == 0) ||
    (strncmp(tempPath.c_str(), dllPath.c_str(), tempPath.GetLength()) == 0));
}
开发者ID:marlboroman,项目名称:xbmc,代码行数:28,代码来源:Win32DllLoader.cpp

示例6: dllGetModuleFileNameA

extern "C" DWORD WINAPI dllGetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
{
  if (NULL == hModule)
  {
    strncpy(lpFilename, "xbmc.xbe", nSize);
    CLog::Log(LOGDEBUG, "GetModuleFileNameA(%p, %p, %u) => '%s'\n",
              hModule, lpFilename, nSize, lpFilename);
    return 8;
  }
  
  LibraryLoader* dll = DllLoaderContainer::GetModule(hModule);
  if( !dll )
  {
    CLog::Log(LOGERROR, "%s - Invalid hModule specified", __FUNCTION__);
    return 0;
  }

  char* sName = dll->GetFileName();
  if (sName)
  {
    strncpy(lpFilename, sName, nSize);
    return strlen(lpFilename);
  }
  
  return 0;
}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:26,代码来源:dll.cpp

示例7: LoadDll

LibraryLoader* DllLoaderContainer::LoadDll(const char* sName, bool bLoadSymbols)
{

#ifdef LOGALL
  CLog::Log(LOGDEBUG, "Loading dll %s", sName);
#endif

  LibraryLoader* pLoader;
#ifdef TARGET_POSIX
  pLoader = new SoLoader(sName, bLoadSymbols);
#elif defined(TARGET_WINDOWS)
  pLoader = new Win32DllLoader(sName, false);
#else
  pLoader = new DllLoader(sName, m_bTrack, false, bLoadSymbols);
#endif

  if (!pLoader)
  {
    CLog::Log(LOGERROR, "Unable to create dll %s", sName);
    return NULL;
  }

  if (!pLoader->Load())
  {
    delete pLoader;
    return NULL;
  }

  return pLoader;
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:30,代码来源:DllLoaderContainer.cpp

示例8: tr

void Project::slotNewProject()
{
    QString fileName = QFileDialog::getSaveFileName(this, tr("New Project"),
                                                    "", tr("Qucs Projects (*.xpro)"));
    if(!fileName.isEmpty()) {
        if(QString(QFileInfo(fileName).suffix()).isEmpty()) {
            fileName = fileName + ".xpro";
        }

        //First we create the folder structure where files are to be placed
        QFileInfo fileInfo = QFileInfo(fileName);
        QDir filePath = QDir(fileInfo.absolutePath() + "/" + fileInfo.baseName());
        if(!filePath.exists()) {
            filePath.setPath(fileInfo.absolutePath());
            filePath.mkdir(fileInfo.baseName());
        }
        fileName = fileInfo.absolutePath() + "/" + fileInfo.baseName() + "/" + fileInfo.fileName();

        //Then we create the library/project
        LibraryLoader *library = LibraryLoader::instance();

        if(library->newLibrary(fileName)) {
            slotCloseProject();
            setCurrentLibrary(fileName);
            projectLibrary = library->library(m_libraryName);
            projectLibrary->saveLibrary();
            qDebug() << "Succesfully created library!";
            m_projectsSidebar->plugLibrary(m_libraryName, "root");
        }
    }
}
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:31,代码来源:project.cpp

示例9: dllGetModuleFileNameA

extern "C" DWORD WINAPI dllGetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
{
  if (NULL == hModule)
  {
#ifdef _WIN32
    return GetModuleFileNameA(hModule, lpFilename, nSize);
#else
    CLog::Log(LOGDEBUG, "%s - No hModule specified", __FUNCTION__);
    return 0;
#endif
  }

  LibraryLoader* dll = DllLoaderContainer::GetModule(hModule);
  if( !dll )
  {
    CLog::Log(LOGERROR, "%s - Invalid hModule specified", __FUNCTION__);
    return 0;
  }

  char* sName = dll->GetFileName();
  if (sName)
  {
    strncpy(lpFilename, sName, nSize);
    return strlen(lpFilename);
  }

  return 0;
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:28,代码来源:dll.cpp

示例10: dllLoadLibraryExtended

extern "C" HMODULE __stdcall dllLoadLibraryExtended(LPCSTR lib_file, LPCSTR sourcedll)
{    
  char libname[MAX_PATH + 1] = {};
  char libpath[MAX_PATH + 1] = {};
  LibraryLoader* dll = NULL; 

  /* extract name */  
  const char* p = strrchr(lib_file, PATH_SEPARATOR_CHAR);
  if (p) 
    strcpy(libname, p+1);
  else 
    strcpy(libname, lib_file);  

  if( libname[0] == '\0' )
    return NULL;

  /* extract path */
  getpath(libpath, lib_file);
  
  CLog::Log(LOGDEBUG, "LoadLibraryA('%s')", libname);
  if (sourcedll)
  {
    /* also check for invalid paths wich begin with a \ */
    if( libpath[0] == '\0' || libpath[0] == PATH_SEPARATOR_CHAR )
    {
      /* use calling dll's path as base address for this call */
      getpath(libpath, sourcedll);

      /* mplayer has all it's dlls in a codecs subdirectory */
      if (strstr(sourcedll, "mplayer.dll"))
        strcat(libpath, "codecs\\");
    }
  }

  /* if we still don't have a path, use default path */
  if( libpath[0] == '\0' )
    strcpy(libpath, DEFAULT_DLLPATH);
  
  /* msdn docs state */
  /* "If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended.  */
  /* However, the file name string can include a trailing point character (.) to indicate that the module name has no extension." */
  if( strrchr(libname, '.') == NULL )
    strcat(libname, ".dll");
  else if( libname[strlen(libname)-1] == '.' )
    libname[strlen(libname)-1] = '\0';

  dll = DllLoaderContainer::LoadModule(libname, libpath);
    
  if (dll)
  {
    CLog::Log(LOGDEBUG, "LoadLibrary('%s') returning: %p", libname, (void*)dll);
    return (HMODULE)dll->GetHModule();
  }

  CLog::Log(LOGERROR, "LoadLibrary('%s') failed", libname);
  return NULL;
}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:57,代码来源:dll.cpp

示例11:

void *xbp_dlsym(void *handle, const char *symbol)
{
  LibraryLoader *pDll = (LibraryLoader*)handle;
  CLog::Log(LOGDEBUG,"%s - load symbol %s", __FUNCTION__, symbol);
  void *f = NULL;
  if (pDll && pDll->ResolveExport(symbol, &f))
    return f;

  return NULL;
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:10,代码来源:exports_python_linux.cpp

示例12: slotCloseProject

void Project::slotCloseProject()
{
    if(projectLibrary) {
        m_projectsSidebar->unPlugLibrary(m_libraryName, "root");
        LibraryLoader *library = LibraryLoader::instance();
        library->unload(m_libraryName);

        projectLibrary = 0;
        m_libraryFileName = "";
        m_libraryName = "";
    }
}
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:12,代码来源:project.cpp

示例13: xbp_dlclose

int xbp_dlclose(void *handle)
{
#ifdef HAS_PYTHON
  LibraryLoader *pDll = (LibraryLoader*)handle;
  CLog::Log(LOGDEBUG,"%s - releasing python library %s", __FUNCTION__, pDll->GetName());
  g_pythonParser.UnregisterExtensionLib(pDll);
  DllLoaderContainer::ReleaseModule(pDll);
  return 0;
#else
  CLog::Log(LOGDEBUG,"Cannot release python lib because python isnt being used!");
  return NULL;
#endif
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:13,代码来源:exports_python_linux.cpp

示例14: dllFreeLibrary

extern "C" int __stdcall dllFreeLibrary(HINSTANCE hLibModule)
{
  LibraryLoader* dllhandle = DllLoaderContainer::GetModule(hLibModule);

  if( !dllhandle )
  {
    CLog::Log(LOGERROR, "%s - Invalid hModule specified",__FUNCTION__);
    return 1;
  }

  // to make sure systems dlls are never deleted
  if (dllhandle->IsSystemDll()) return 1;

  DllLoaderContainer::ReleaseModule(dllhandle);

  return 1;
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:17,代码来源:dll.cpp

示例15:

bool Win32DllLoader::NeedsHooking(const char *dllName)
{
  if ( !StringUtils::EndsWithNoCase(dllName, "libdvdcss-2.dll")
  && !StringUtils::EndsWithNoCase(dllName, "libdvdnav.dll"))
    return false;

  LibraryLoader *loader = DllLoaderContainer::GetModule(dllName);
  if (loader)
  {
    // may have hooked this already (we can have repeats in the import table)
    for (unsigned int i = 0; i < m_referencedDlls.size(); i++)
    {
      if (loader->GetHModule() == m_referencedDlls[i])
        return false;
    }
  }
  return true;
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:18,代码来源:Win32DllLoader.cpp


注:本文中的LibraryLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。