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


C++ DynamicLibrary类代码示例

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


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

示例1: DynamicLibrary

Plugin* Plugin::LoadPlugin(const char* pluginFile)
{
    DynamicLibrary* lib = new DynamicLibrary();
    if( !lib->Load(pluginFile) )
    {
        delete lib;
        return 0;
    }

    PluginAccessor accessor = (PluginAccessor)lib->FindFunction("GetPlugin");
    if( !accessor )
    {
        delete lib;
        return 0;
    }

    Plugin* plugin = accessor(Memory::sInstance, Assert::sInstance);
    if( !plugin )
    {
        delete lib;
        return 0;
    }

    plugin->SetLibrary(lib);
    return plugin;
}
开发者ID:RonOHara-GG,项目名称:PTEngine,代码行数:26,代码来源:Plugin.cpp

示例2: plugins_file

void Application::RegisterAllPlugins()
{
  std::ifstream plugins_file(cpw::ApplicationConfiguration::GetInstance()->GetPluginsFile().c_str());	
  if (plugins_file.is_open())
    {

      while (!plugins_file.eof())
	{
	  std::string plugin;
	  plugins_file >> plugin;
	  DynamicLibrary *library = new DynamicLibrary();
	  if (plugin=="")
	    continue;
	  library->Load(plugin);
	  if (library->GetH() != NULL)
	    {
	      std::string str1;
	      library->RegisterPluginMenu(str1);
	      int id = main_frame->AddPluginMenu(str1);
	      plugin_map[id] = library;
	    }
	  else
	    if (library)
	      {
		delete library;
		library = NULL;
	      }
			
	}
      plugins_file.close();
    }
}
开发者ID:BackupTheBerlios,项目名称:rvzware,代码行数:32,代码来源:Application.cpp

示例3: LOG_DEBUG

void PluginManager::loadDynamicPlugins(std::string& plugins_path)
{
    LOG_DEBUG("Loading dynamic plugins");
    Poco::Path plugin_directory = Poco::Path::forDirectory(plugins_path);
    plugin_directory.popDirectory();
    plugin_directory.pushDirectory("plugins");
    LOG_DEBUG("Plugin directory: " << plugin_directory.toString());
    std::set<std::string> dll_files;
    Poco::Glob::glob(plugin_directory.append(DynamicLibrary::DL_PREFIX+
                                             "*."+
                                             DynamicLibrary::DL_SUFFIX), 
                     dll_files);

    for (std::set<std::string>::iterator it = dll_files.begin(); 
         it!=dll_files.end(); 
         ++it)
    {
        std::string plugin_file = *it;
        LOG_DEBUG("Loading library " << plugin_file);
        DynamicLibrary* dl = DynamicLibrary::load(plugin_file);
        registerPluginFunction registerPlugin = 
            (registerPluginFunction)dl->getSymbol("registerPlugin");
        if (registerPlugin)
        {
            LOG_DEBUG("Initialize Plugin " << *it);
            registerPlugin(this);
        } else
        {
            LOG_WARN("Couldn't find registerPlugin for " << *it);
        }
    }

}
开发者ID:Jokymon,项目名称:anthaxia,代码行数:33,代码来源:PluginManager.cpp

示例4: loadPlugin

// --- Plugin Loading ------------------------------------------------------ //
/// Loads a plugin from \p fileName. Returns \c false if an error
/// occurs.
bool PluginManager::loadPlugin(const std::string &fileName)
{
    DynamicLibrary *library = new DynamicLibrary;
    library->setFileName(fileName);
    bool ok = library->open();
    if(!ok){
        std::cerr << "PluginManager: Error: Failed to load plugin: (" << fileName << "):"
                  << library->errorString() << std::endl;

        return false;
    }

    typedef Plugin* (*InitFunction)();
    InitFunction initFunction = reinterpret_cast<InitFunction>(library->resolveFunction("chemkit_plugin_init"));
    if(!initFunction){
        std::cerr << "PluginManager: Error: Failed to load plugin: (" << fileName << "):"
                  << "Plugin contains no init() function." << std::endl;

        return false;
    }

    Plugin *plugin = initFunction();
    if(!plugin){
        std::cerr << "PluginManager: Error: Failed to load plugin: (" << fileName << "):"
                  << "Calling the plugin's init() function failed." << std::endl;

        return false;
    }

    plugin->setLibrary(library);

    d->plugins.push_back(plugin);

    return true;
}
开发者ID:NabilNoaman,项目名称:chemkit,代码行数:38,代码来源:pluginmanager.cpp

示例5: DynamicLibrary

	bool Core::LoadModule(const string& cModule)
	{
		_lDynamicLibrary::iterator it_DynamicLibrary = m_lDynamicLibrary.find(cModule);

		if (it_DynamicLibrary == m_lDynamicLibrary.end())
		{
			DynamicLibrary* pModule = new DynamicLibrary(cModule, mLogger);

			if (pModule->CheckWork())
			{
				START_DLL_MODULE pFunc = (START_DLL_MODULE)pModule->GetAddress("Start_DexDynamicLibrary");
				pFunc(this);

				m_lDynamicLibrary[cModule] = pModule;

				return true;
			}
			else
			{
				DrawLine("LoadModule: Ìîäóëü " + cModule + " íå ðàáîòàåò!", MessageTypes::MT_ERROR);
			}
		}
		else
		{
			DrawLine("LoadModule: Ìîäóëü " + cModule + " óæå çàãðóæåí", MT_WARNING);
		}

		return false;
	}
开发者ID:LeonDEXZ,项目名称:Bloodstone-Engine,代码行数:29,代码来源:DEXCore.cpp

示例6: TEST

TEST(DynamicLibrary, Unsupported) {
  std::string Err;
  DynamicLibrary DL =
      DynamicLibrary::getPermanentLibrary(LibPath().c_str(), &Err);
  EXPECT_FALSE(DL.isValid());
  EXPECT_EQ(Err, "dlopen() not supported on this platform");
}
开发者ID:BNieuwenhuizen,项目名称:llvm,代码行数:7,代码来源:DynamicLibraryTest.cpp

示例7: registerBuiltinCheckers

ClangCheckerRegistry::ClangCheckerRegistry(ArrayRef<std::string> plugins,
                                           DiagnosticsEngine *diags) {
  registerBuiltinCheckers(*this);

  for (ArrayRef<std::string>::iterator i = plugins.begin(), e = plugins.end();
       i != e; ++i) {
    // Get access to the plugin.
    DynamicLibrary lib = DynamicLibrary::getPermanentLibrary(i->c_str());

    // See if it's compatible with this build of clang.
    const char *pluginAPIVersion =
      (const char *) lib.getAddressOfSymbol("clang_analyzerAPIVersionString");
    if (!isCompatibleAPIVersion(pluginAPIVersion)) {
      warnIncompatible(diags, *i, pluginAPIVersion);
      continue;
    }

    // Register its checkers.
    RegisterCheckersFn registerPluginCheckers =
      (RegisterCheckersFn) (intptr_t) lib.getAddressOfSymbol(
                                                      "clang_registerCheckers");
    if (registerPluginCheckers)
      registerPluginCheckers(*this);
  }
}
开发者ID:CODECOMMUNITY,项目名称:clang,代码行数:25,代码来源:CheckerRegistration.cpp

示例8: AProNew

    ResourcePtr DynamicLibraryLoader::loadResource(const String& filename)
    {
        DynamicLibrary* dynlib = AProNew(DynamicLibrary, filename);

        if(dynlib->isLoaded())
            return ResourcePtr(dynlib);
        else
            return ResourcePtr();
    }
开发者ID:luk2010,项目名称:aproe,代码行数:9,代码来源:DynamicLibraryLoader.cpp

示例9: LLVMRustLoadDynamicLibrary

extern "C" LLVMBool LLVMRustLoadDynamicLibrary(const char *path)
{
    std::string err;
    DynamicLibrary lib = DynamicLibrary::getPermanentLibrary(path, &err);

    if (!lib.isValid())
        LLVMRustSetLastError(err.c_str());

    return lib.isValid();
}
开发者ID:0X1A,项目名称:rust,代码行数:10,代码来源:ExecutionEngineWrapper.cpp

示例10: loadCrate

bool RustMCJITMemoryManager::loadCrate(const char* file, std::string* err) {
  DynamicLibrary crate = DynamicLibrary::getPermanentLibrary(file,
                                                             err);

  if(crate.isValid()) {
    crates.insert(&crate);

    return true;
  }

  return false;
}
开发者ID:BrandonBarrett,项目名称:rust,代码行数:12,代码来源:RustWrapper.cpp

示例11: test_desobj

void test_desobj()
{
    ErrorOr<ObjectFile *> objfile = ObjectFile::createObjectFile("/usr/lib/libQtCore.so");
    ObjectFile *pobj = objfile.get();

    qDebug()<<"heheho"<<pobj->getFileFormatName().data();
    int i = 0;

    DynamicLibrary dlib = DynamicLibrary::getPermanentLibrary("/usr/lib/libQt5Core.so");
    qDebug()<<dlib.isValid();
    void *addr = dlib.SearchForAddressOfSymbol("_ZN7QString4chopEi");
    qDebug()<<"addr:"<<addr;
}
开发者ID:kitech,项目名称:ruby-jit-qt,代码行数:13,代码来源:desobj.cpp

示例12: TEST_BEGIN

} TEST_END

TEST_BEGIN(base, dynamic_library) {

  DynamicLibrary dync;
  rc_t rc = dync.open(_STR("base_unittest.dll"));
  ASSERT_EQ(RC_S_OK, rc);

  typedef void (*PFN_TEST_CALL)();
  PFN_TEST_CALL pfn_call = dync.LocateSymbol<PFN_TEST_CALL>(_STR("base_dynamic_library_test"));
  ASSERT_NE(NULL, pfn_call);

  (pfn_call)();

  ASSERT_EQ(TRUE, gbCall);

} TEST_END
开发者ID:obabywawa,项目名称:logsystem,代码行数:17,代码来源:dynamic_library_unittest.cpp

示例13: showServerControls

void FaceTrackNoIR::showServerControls() {
    if (pProtocolDialog) {
        delete pProtocolDialog;
        pProtocolDialog = NULL;
    }

    DynamicLibrary* lib = dlopen_protocols.value(ui.iconcomboProtocol->currentIndex(), (DynamicLibrary*) NULL);

    if (lib && lib->Dialog) {
        pProtocolDialog = (IProtocolDialog*) lib->Dialog();
        if (pProtocolDialog) {
            auto foo = dynamic_cast<QWidget*>(pProtocolDialog);
            foo->setFixedSize(foo->size());
            dynamic_cast<QWidget*>(pProtocolDialog)->show();
        }
    }
}
开发者ID:vheathen,项目名称:opentrack,代码行数:17,代码来源:facetracknoir.cpp

示例14: showFilterControls

void FaceTrackNoIR::showFilterControls() {
    if (pFilterDialog) {
        delete pFilterDialog;
        pFilterDialog = NULL;
    }

    DynamicLibrary* lib = dlopen_filters.value(ui.iconcomboFilter->currentIndex(), (DynamicLibrary*) NULL);

    if (lib && lib->Dialog) {
        pFilterDialog = (IFilterDialog*) lib->Dialog();
        if (pFilterDialog) {
            auto foo = dynamic_cast<QWidget*>(pFilterDialog);
            foo->setFixedSize(foo->size());
            if (Libraries && Libraries->pFilter)
                pFilterDialog->registerFilter(Libraries->pFilter);
            dynamic_cast<QWidget*>(pFilterDialog)->show();
        }
    }
}
开发者ID:vheathen,项目名称:opentrack,代码行数:19,代码来源:facetracknoir.cpp

示例15: showSecondTrackerSettings

void FaceTrackNoIR::showSecondTrackerSettings() {
    if (pSecondTrackerDialog) {
        delete pSecondTrackerDialog;
        pSecondTrackerDialog = NULL;
    }

    DynamicLibrary* lib = dlopen_trackers.value(ui.cbxSecondTrackerSource->currentIndex() - 1, (DynamicLibrary*) NULL);

    if (lib) {
        pSecondTrackerDialog = (ITrackerDialog*) lib->Dialog();
        if (pSecondTrackerDialog) {
            auto foo = dynamic_cast<QWidget*>(pSecondTrackerDialog);
            foo->setFixedSize(foo->size());
            if (Libraries && Libraries->pSecondTracker)
                pSecondTrackerDialog->registerTracker(Libraries->pSecondTracker);
            dynamic_cast<QWidget*>(pSecondTrackerDialog)->show();
        }
    }
}
开发者ID:vheathen,项目名称:opentrack,代码行数:19,代码来源:facetracknoir.cpp


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