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


C++ LoadModule函数代码示例

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


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

示例1: LoadModule

	Module* VirtualMachine::LoadModule(const ModuleName &name, bool noreflection, bool debug, Module *hint)
	{
        // Check for an already loaded module.
        // TODO: Add security.
        LoadedModulesByName::iterator it = loadedModulesByName.find(name.name);
        if(it != loadedModulesByName.end())
            return it->second;

        // Use the filename if present
        if(!name.filename.empty())
    		return LoadModule(name.filename, debug);

        // Try to load the module.
        std::string baseName = name.name + ".cbm";
        std::string fileName;
        if(FindModule(baseName, &fileName, hint))
            return LoadModule(fileName, noreflection, debug);

        // Try to load embedded module.
        // ELF module.
        baseName = "lib" + name.name + ".so";
        if(FindModule(baseName, &fileName, hint))
            return LoadModule(fileName, noreflection, debug);

        // PE module.
        baseName = name.name + ".dll";
        if(FindModule(baseName, &fileName, hint))
            return LoadModule(fileName, noreflection, debug);

        return NULL;
	}
开发者ID:ronsaldo,项目名称:chela,代码行数:31,代码来源:VirtualMachine.cpp

示例2: LoadSos

    void
    LoadSos(LLDBServices *services)
    {
        if (m_sosHandle == NULL)
        {
            if (g_coreclrDirectory == NULL)
            {
                const char *coreclrModule = MAKEDLLNAME_A("coreclr");
                const char *directory = services->GetModuleDirectory(coreclrModule);
                if (directory != NULL)
                {
                    std::string path(directory);
                    path.append("/");
                    g_coreclrDirectory = strdup(path.c_str());
                }
                else
                {
                    services->Output(DEBUG_OUTPUT_WARNING, "The %s module is not loaded yet in the target process\n", coreclrModule);
                }
            }

            if (g_coreclrDirectory != NULL)
            {
                // Load the DAC module first explicitly because SOS and DBI
                // have implicit references to the DAC's PAL.
                LoadModule(services, MAKEDLLNAME_A("mscordaccore"));

                m_sosHandle = LoadModule(services, MAKEDLLNAME_A("sos"));
            }
        }
    }
开发者ID:ROOTU,项目名称:coreclr,代码行数:31,代码来源:soscommand.cpp

示例3: while

//
// Setup server: create sockets, load modules, etc
//
INT_32 MainProcess::Setup(Logger  & oLogger,
                          bool    & bLoggerStarted)
{
	// Initialize loggers, before of all other modules
	oLogger.Info("Starting logger subsystem");
	STLW::vector<ModuleConfig>::const_iterator itvLoggers = oGlobalContext.config.loggers.begin();
	while (itvLoggers != oGlobalContext.config.loggers.end())
	{
		const INT_32 iRC = LoadModule(itvLoggers -> type,
		                              itvLoggers -> name,
		                              itvLoggers -> library,
		                              itvLoggers -> driver,
		                              itvLoggers -> params,
		                              oGlobalContext.config.libexec_dirs,
		                              oLogger);
		if (iRC != 0) { return iRC; }
		oLogger.Info("Logger `%s` started", itvLoggers -> name.c_str());
		++itvLoggers;
	}

	// Get logger from factory for main process
	Object * pObject = oGlobalContext.factory.GetObject("Logger/" + oGlobalContext.config.logger_type);
	if (pObject == NULL)
	{
		oLogger.Emerg("Can't get main process logger `%s`", oGlobalContext.config.logger_type.c_str());
		return -1;
	}

	oLogger.Info("Logger subsystem started");

	// Start logger subsystem
	oGlobalContext.error_log  = static_cast<LoggerObject *>(pObject) -> GetErrorLog(NULL);
	oGlobalContext.error_log -> Notice("Log started");

	oGlobalContext.transfer_log = static_cast<LoggerObject *>(pObject) -> GetCustomLog(NULL);
	oGlobalContext.transfer_log -> Notice("Log started");

	bLoggerStarted = true;

	// Load modules
	oGlobalContext.error_log -> Info("Starting modules");
	STLW::vector<ModuleConfig>::const_iterator itvModules = oGlobalContext.config.modules.begin();
	while(itvModules != oGlobalContext.config.modules.end())
	{
		const INT_32 iRC = LoadModule(itvModules -> type,
		                              itvModules -> name,
		                              itvModules -> library,
		                              itvModules -> driver,
		                              itvModules -> params,
		                              oGlobalContext.config.libexec_dirs,
		                             *oGlobalContext.error_log);
		if (iRC != 0) { return iRC; }

		++itvModules;
	}
	oGlobalContext.error_log -> Info("All modules started");

return 0;
}
开发者ID:CommunicoPublic,项目名称:iris,代码行数:62,代码来源:MainProcess.cpp

示例4: LoadModule

TSharedPtr<IModuleInterface> FModuleManager::LoadModuleChecked( const FName InModuleName, const bool bWasReloaded )
{
	TSharedPtr<IModuleInterface> Module = LoadModule(InModuleName, bWasReloaded);
	check(Module.IsValid());

	return Module;
}
开发者ID:mysheng8,项目名称:UnrealEngine,代码行数:7,代码来源:ModuleManager.cpp

示例5: main

//
//The actual do something code.
//
int main( void )
{
    unsigned char *DLL;

    void _cdecl (*DLLFunction)(char *);

    printf( "EXE File name: %s\n", GetModuleFileName( _psp ) );
    printf( "Program name: %s\n", _LpPgmName );
    printf( "Load module: %s\n", ModuleName );
    // Try and load the module.
    DLL = LoadModule( ModuleName );
    if( DLL ) {

        printf( "Module %s loaded sucessfully\n", ModuleName );

        // Fetch the test function address
        DLLFunction = GetProcAddress( DLL, "_SayHello" );

        if( DLLFunction ) {
            // Give the test function a shout
            DLLFunction( "Hello World!" );
        } else {
            printf( "Failed to GetProcAddress\n" );
        }

        printf( "Free module: %s\n", ModuleName );
        // Lose the module again
        FreeModule( DLL );
        printf( "Module %s discarded\n", ModuleName );

    } else {
        printf( "Failed to load %s module...\n", ModuleName );
    }
    return( 0 );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:38,代码来源:dlltest.c

示例6: os2exec_load_component

long DICE_CV
os2exec_load_component (CORBA_Object _dice_corba_obj,
                        unsigned long hmod /* in */,
			os2exec_module_t *s /* out */,
                        CORBA_Server_Environment *_dice_corba_env)
{
  unsigned long rc;
  char chLoadError[CCHMAXPATH];
  IXFModule *ixf;
  IXFSYSDEP *sysdep;

  rc = LoadModule(chLoadError, sizeof(chLoadError), &hmod);

  ixf = (IXFModule *)hmod;
  s->ip = ixf->EntryPoint;
  
  sysdep = (IXFSYSDEP *)(ixf->hdlSysDep);
  s->sp = sysdep->stack_high;
  s->sp_limit = sysdep->stack_low;
  s->hmod = hmod;

  LOG("load_component exited");  
  
  return rc;
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:25,代码来源:main.c

示例7: LoadModulePerf

APIRET LoadModulePerf(PSZ pszModuleName,
                      PHMODULE phModule)
{
  PERFSTRUCT TS_Start;
  PERFSTRUCT TS_End;
  ULONG      ulFreeStart;
  ULONG      ulFreeEnd;
  double     seconds;
  APIRET     rc;                                  /* operation return code */

  printf ("Loading %s ...\n",
          pszModuleName);

  ulFreeStart = QueryFreeMemory();
  ToolsPerfQuery (&TS_Start);                    /* exact time measurement */

  rc = LoadModule(pszModuleName,
                  phModule);

  ToolsPerfQuery (&TS_End);                      /* exact time measurement */
  seconds = TS_End.fSeconds - TS_Start.fSeconds;     /* calculate duration */
  ulFreeEnd = QueryFreeMemory();

  printf("%u kb used, %11.6f ms\n",                  /* print report */
         (ulFreeStart - ulFreeEnd) / 1024,
         seconds * 1000.0);

  return rc;                                                         /* OK */
}
开发者ID:OS2World,项目名称:DEV-UTIL-OS2Tools,代码行数:29,代码来源:testmod.c

示例8: sprintf

void ModuleManager::LoadModulesInFolder( const Char* pModuleDir )
{
    Vector<String>              moduleNames;
    Vector<String>::iterator    itList;
    String                      moduleName;
    Char                        searchFor[256];
    
    sprintf( searchFor, "*%s", LIBRARY_EXTENSION );
    FileManager::FindFiles( pModuleDir, searchFor, moduleNames );

// If we're in release mode on windows, ignore debug dlls
#if !defined(GD_DEBUG) && defined(GD_WINDOWS)
    for( itList = moduleNames.begin(); itList != moduleNames.end(); )
    {
        if( (*itList).substr( (*itList).length() - strlen(LIBRARY_EXTENSION_DEBUG) ) == LIBRARY_EXTENSION_DEBUG )
            moduleNames.erase( itList );
        else
            ++itList;
    }
#endif

    // Remove LIBRARY_EXTENSION from the end
    // Call LoadModule on each item.
    for( itList = moduleNames.begin(); itList != moduleNames.end(); ++itList )
    {
        moduleName = (*itList).substr( 0, (*itList).length() - strlen(LIBRARY_EXTENSION) );
        LoadModule( moduleName.c_str(), pModuleDir );
    }
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:29,代码来源:ModuleManager.cpp

示例9: ConfigReader

void tweakbukconv::Init(std::string configfile)
{
    reader = new ConfigReader();
    groups = new Groups();
    users = new Users();
    if (reader->ReadFile(configfile))
    {
        std::cout << "W00p config is gelezen \\o/" << std::endl;
    }
    else
    {
        std::cout << "Kon niet lezen :/" << std::endl;
    }

    std::string loadmodsstr;
    loadmodsstr = reader->GetString("loadmods");
    moduledir = reader->GetString("moduledir");
    hostname_str = reader->GetString("hostname");
    databasename_str = reader->GetString("databasename");
    username_str = reader->GetString("username");
    pass_str = reader->GetString("password");
	GetGroupsDB();
    std::vector< std::string > loadmods;
    boost::split( loadmods, loadmodsstr, boost::is_any_of(" "), boost::token_compress_on );
    for (unsigned int i = 0; i < loadmods.size(); i++)
    {
        LoadModule(loadmods[i]);
    }
    tweakloop = true;
    assert(!tweak_thread);
    tweak_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&tweakbukconv::tweakrun, this)));
}
开发者ID:kwakkel1000,项目名称:tweak-buk-conv,代码行数:32,代码来源:tweakbukconv.cpp

示例10: xf86LoadOneModule

/*
 * xf86LoadOneModule loads a single module.
 */
pointer
xf86LoadOneModule(char *name, pointer opt)
{
    int errmaj, errmin;
    char *Name;
    pointer mod;

    if (!name)
	return NULL;

    /* Normalise the module name */
    Name = xf86NormalizeName(name);

    /* Skip empty names */
    if (Name == NULL)
	return NULL;
    if (*Name == '\0') {
	free(Name);
	return NULL;
    }

    mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin);
    if (!mod)
	LoaderErrorMsg(NULL, Name, errmaj, errmin);
    free(Name);
    return mod;
}
开发者ID:timon37,项目名称:xwayland,代码行数:30,代码来源:xf86Helper.c

示例11: Initialize

	void Initialize() override
	{
		if (FOculusAudioPlugin::NumInstances == 0)
		{
			if (!LoadModule())
			{
				UE_LOG(LogAudio, Error, TEXT("Failed to load OVR Audio dll"));
				return;
			}
		}

		FOculusAudioPlugin::NumInstances++;

		if (!FOculusAudioPlugin::bInitialized)
		{
			// Check the version number
			int32 MajorVersionNumber;
			int32 MinorVersionNumber;
			int32 PatchNumber;

			// Initialize the OVR Audio SDK before making any calls to ovrAudio
			ovrResult Result = ovrAudio_Initialize();
			OVR_AUDIO_CHECK(Result, "Failed to initialize OVR Audio system");

			const char* OvrVersionString = ovrAudio_GetVersion(&MajorVersionNumber, &MinorVersionNumber, &PatchNumber);
			if (MajorVersionNumber != OVR_AUDIO_MAJOR_VERSION || MinorVersionNumber != OVR_AUDIO_MINOR_VERSION)
			{
				UE_LOG(LogAudio, Warning, TEXT("Using mismatched OVR Audio SDK Versiont! %d.%d vs. %d.%d"), OVR_AUDIO_MAJOR_VERSION, OVR_AUDIO_MINOR_VERSION, MajorVersionNumber, MinorVersionNumber);
				return;
			}
			FOculusAudioPlugin::bInitialized = true;
		}
	}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:33,代码来源:OculusAudio.cpp

示例12: fact1

void LibFiles::Extract(FILE *stream, const ObjString &Name)
{
    int count = 0;
    ObjIeeeIndexManager im1;
    ObjFactory fact1(&im1);
    for (FileIterator it = FileBegin(); it != FileEnd(); ++it)
    {
        if ((*it)->name == Name)
        {
            ObjFile *p = LoadModule(stream, count, &fact1);
            if (p)
            {
                FILE *ostr = fopen(Name.c_str(), "wb");
                if (ostr != NULL)
                {
                    WriteData(ostr, p, (*it)->name);
                    fclose(ostr);
                }
                else
                {
                    std::cout << "Warning: Module '" << Name << "' not extracted, could not open output file" << std::endl;
                }
            }
            else
            {
                std::cout << "Warning: Module '" << Name << "' not extracted, library corrupt" << std::endl;
            }
            return;
        }
    }
    std::cout << "Warning: Module '" << Name << "' not in library and could not be extracted" << std::endl;
}
开发者ID:doniexun,项目名称:OrangeC,代码行数:32,代码来源:LibFilesLibrarian.cpp

示例13: LoadAllModules

// Load the CSV, create servers for each entry
int32_t ModuleManager::LoadAllModules()
{
    int32_t ServerCount{};
    CSVManager FileManager;

    // Read the entries from the CSV.
    FileManager.ReadFile("Plugins\\OpennetStorage\\Modules.csv", 3);

    // Decrypt and load all modules.
    for (uint32_t i = 0; i < FileManager.Buffer->size(); ++i)
    {
        // Check for duplicates.
        for (uint32_t c = 0; c < ModuleList.size(); ++c)
        {
            if (!_stricmp(ModuleList[c]->Filename.c_str(), (*FileManager.Buffer)[i][1].c_str()))
            {
                goto LABEL_SKIP_LOADING;
            }
        }

        // Decrypt and load.
        if (DecryptModule((*FileManager.Buffer)[i][1].c_str(), (*FileManager.Buffer)[i][2].c_str()))
        {
            if (!LoadModule(ModuleList.back()))
                ModuleList.pop_back();
        }
        else
        {
            fDebugPrint("%s: Failed to load module \"%s\".", __func__, (*FileManager.Buffer)[i][1].c_str());
        }

    LABEL_SKIP_LOADING:;
    }

    // Load all requested servers.
    for (uint32_t i = 0; i < FileManager.Buffer->size(); ++i)
    {
        for (uint32_t c = 0; c < ModuleList.size(); ++c)
        {
            if (!_stricmp(ModuleList[c]->Filename.c_str(), (*FileManager.Buffer)[i][1].c_str()))
            {
                static IServer *NewServer;
                NewServer = CreateServerInstance(ModuleList[c], (*FileManager.Buffer)[i][0].c_str());

#ifdef _WIN32
                if (NewServer != nullptr)
                {
                    NTServerManager::RegisterServerInterface(NewServer);
                    ServerCount++;
                }
#else
#endif
            }
        }

    }

    fDebugPrint("%s: Loaded %i modules.", __func__, ServerCount);
    return ServerCount;
}
开发者ID:KerriganEN,项目名称:OpenNetPlugin,代码行数:61,代码来源:ModuleManager.cpp

示例14: My_LoadModule

BOOL My_LoadModule()
{
	LPCSTR lpModuleName=NULL;
	LPVOID lpParameterBlock=NULL;
	DWORD returnVal_Real = NULL;
	DWORD returnVal_Intercepted = NULL;

	DWORD error_Real = 0;
	DWORD error_Intercepted = 0;
	disableInterception();
	returnVal_Real = LoadModule (lpModuleName,lpParameterBlock);
	error_Real = GetLastError();
	enableInterception();
	returnVal_Intercepted = LoadModule (lpModuleName,lpParameterBlock);
	error_Intercepted = GetLastError();
	return ((returnVal_Real == returnVal_Intercepted) && (error_Real == error_Intercepted));
}
开发者ID:IFGHou,项目名称:Holodeck,代码行数:17,代码来源:LoadModule.cpp

示例15: LoadModule

void CCore::LoadModules()
{
	for (int i = 0; i < s_ServerConfig->GetSettingSize("luamodules"); i++)
	{
		std::string moduleName = s_ServerConfig->GetSetting("luamodules", i);
		CUtility::printf("Loading module: %s", moduleName.c_str());
		LoadModule(moduleName);
	}
}
开发者ID:drakeee,项目名称:samp-plugin-lua,代码行数:9,代码来源:CCore.cpp


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