コード例 #1
0
ファイル: VirtualMachine.cpp プロジェクト: ronsaldo/chela
	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;
	}
コード例 #2
0
ファイル: soscommand.cpp プロジェクト: ROOTU/coreclr
    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"));
            }
        }
    }
コード例 #3
0
ファイル: MainProcess.cpp プロジェクト: CommunicoPublic/iris
//
// 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;
}
コード例 #4
0
TSharedPtr<IModuleInterface> FModuleManager::LoadModuleChecked( const FName InModuleName, const bool bWasReloaded )
{
	TSharedPtr<IModuleInterface> Module = LoadModule(InModuleName, bWasReloaded);
	check(Module.IsValid());

	return Module;
}
コード例 #5
0
ファイル: dlltest.c プロジェクト: ABratovic/open-watcom-v2
//
//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 );
}
コード例 #6
0
ファイル: main.c プロジェクト: ErisBlastar/osfree
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;
}
コード例 #7
0
ファイル: testmod.c プロジェクト: OS2World/DEV-UTIL-OS2Tools
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 */
}
コード例 #8
0
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 );
    }
}
コード例 #9
0
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)));
}
コード例 #10
0
ファイル: xf86Helper.c プロジェクト: timon37/xwayland
/*
 * 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;
}
コード例 #11
0
ファイル: OculusAudio.cpp プロジェクト: frobro98/UnrealSource
	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;
		}
	}
コード例 #12
0
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;
}
コード例 #13
0
// 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;
}
コード例 #14
0
ファイル: LoadModule.cpp プロジェクト: IFGHou/Holodeck
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));
}
コード例 #15
0
ファイル: CCore.cpp プロジェクト: drakeee/samp-plugin-lua
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);
	}
}
コード例 #16
0
ファイル: LoadModule.cpp プロジェクト: IFGHou/Holodeck
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;
	__try{
	disableInterception();
	returnVal_Real = LoadModule (lpModuleName,lpParameterBlock);
	error_Real = GetLastError();
	enableInterception();
	returnVal_Intercepted = LoadModule (lpModuleName,lpParameterBlock);
	error_Intercepted = GetLastError();
	}__except(puts("in filter"), 1){puts("exception caught");}
	return ((returnVal_Real == returnVal_Intercepted) && (error_Real == error_Intercepted));
}
コード例 #17
0
IdentInterface *ModuleManager::CreateProviderInstance(const PluginID & providerID,
                                                      const wxString & path)
{
   if (path.IsEmpty() && mDynModules.find(providerID) != mDynModules.end())
   {
      return mDynModules[providerID];
   }

   return LoadModule(path);
}
コード例 #18
0
ファイル: MainProcess.cpp プロジェクト: CommunicoPublic/iris
//
// Initialize handlers
//
INT_32 MainProcess::InitHandlers()
{
	// Load handlers
	oGlobalContext.error_log -> Info("Starting handlers");
	STLW::vector<HandlerConfig>::const_iterator itvHandlers = oGlobalContext.config.handlers.begin();
	while (itvHandlers != oGlobalContext.config.handlers.end())
	{
		const INT_32 iRC = LoadModule(itvHandlers -> type,
		                              itvHandlers -> name,
		                              itvHandlers -> library,
		                              itvHandlers -> driver,
		                              itvHandlers -> params,
		                              oGlobalContext.config.libexec_dirs,
		                              *oGlobalContext.error_log);
		if (iRC != 0) { return iRC; }

		oGlobalContext.error_log -> Info("Handler `%s` started", itvHandlers -> name.c_str());

		++itvHandlers;
	}

	// Initialize handlers
	itvHandlers = oGlobalContext.config.handlers.begin();
	while (itvHandlers != oGlobalContext.config.handlers.end())
	{
		// Initialize handler
		Handler * pHandler = static_cast<Handler *>(oGlobalContext.factory.GetObject(itvHandlers -> type + '/' + itvHandlers -> name));
		const INT_32 iRC = pHandler -> InitHandler(oGlobalContext, *itvHandlers, *oGlobalContext.error_log);
		if (iRC != 0) { return iRC; }

		oGlobalContext.error_log -> Info("Handler `%s` initialized", itvHandlers -> name.c_str());

		++itvHandlers;
	}
	oGlobalContext.error_log -> Info("All handlers started");

	oGlobalContext.error_log -> Info("Adding handlers to listeners");

	STLW::vector<ServiceConfig>::iterator itvServices = oGlobalContext.config.services.begin();
	while (itvServices != oGlobalContext.config.services.end())
	{
		// Get handler from factory
		Object * pObject = oGlobalContext.factory.GetObject("Handler/" + itvServices -> handler_name);
		if (pObject == NULL)
		{
			oGlobalContext.error_log -> Emerg("Can't find handler `%s`", itvServices -> handler_name.c_str());
			return -1;
		}
		itvServices -> handler = pObject;
		++itvServices;
	}
	oGlobalContext.error_log -> Info("Adding handlers to listeners finished");

return 0;
}
コード例 #19
0
//----------------------------------------------------------------------------
//  ExecuteGlobal
STDMETHODIMP CMagpieApplication::ExecuteGlobal(
  const OLECHAR* lpszModuleID, VARIANT *result)
{
  // load the module
  CComPtr<CMagpieModuleComObject> pModule;
  // note that scripts executed in global context DON'T GET WRAPPED!
  // 4th arg to LoadModule is FALSE for this reason.
  // See stdafx.h, gJscript9ModuleWrapperIntro and CMagpieModule::Init()
  IF_FAILED_RET(LoadModule(NULL, lpszModuleID, NULL, FALSE, pModule.p));

  return m_ScriptEngine.ExecuteGlobal((CMagpieModule*)pModule.p, result);
}
コード例 #20
0
//-----------------------------------------------------------------------------
// The application object
//-----------------------------------------------------------------------------
bool CUnitTestApp::Create()
{
	// Install a special Spew handler that ignores all assertions and lets us
	// run for as long as possible
	SpewOutputFunc( UnitTestSpew );

	// FIXME: This list of dlls should come from the unittests themselves
	AppSystemInfo_t appSystems[] = 
	{
		{ "vstdlib.dll",			PROCESS_UTILS_INTERFACE_VERSION },
		{ "", "" }	// Required to terminate the list
	};

	if ( !AddSystems( appSystems ) ) 
		return false;

	// Very simple... just iterate over all .DLLs in the current directory 
	// see if they export UNITTEST_INTERFACE_VERSION. If not, then unload them
	// just as quick.

	// We may want to make this more sophisticated, giving it a search path,
	// or giving test DLLs special extensions, or statically linking the test DLLs
	// to this program.

	WIN32_FIND_DATA findFileData;
	HANDLE hFind= FindFirstFile("*.dll", &findFileData);

	while (hFind != INVALID_HANDLE_VALUE)
	{
		CSysModule* hLib = Sys_LoadModule(findFileData.cFileName);
		if ( hLib )
		{
			CreateInterfaceFn factory = Sys_GetFactory( hLib );
			if ( factory && factory( UNITTEST_INTERFACE_VERSION, NULL ) )
			{
				AppModule_t module = LoadModule( factory );
				AddSystem( module, UNITTEST_INTERFACE_VERSION );
			}
			else
			{
				Sys_UnloadModule( hLib );
			}
		}

		if (!FindNextFile( hFind, &findFileData ))
			break;
	}

	return true;
}
コード例 #21
0
ファイル: Modules.cpp プロジェクト: stevestreza/ZNC-Node
bool CModules::ReloadModule(const CString& sModule, const CString& sArgs, CUser* pUser, CString& sRetMsg) {
	CString sMod = sModule;  // Make a copy incase the reference passed in is from CModule::GetModName()
	sRetMsg = "";
	if (!UnloadModule(sMod, sRetMsg)) {
		return false;
	}

	if (!LoadModule(sMod, sArgs, pUser, sRetMsg)) {
		return false;
	}

	sRetMsg = "Reloaded module [" + sMod + "]";
	return true;
}
コード例 #22
0
ファイル: rootlogon.C プロジェクト: Yassid/ENSoft
void rootlogon()
{
  char* c = getenv("TARTSYS");
  if(c){
    std::string install_dir(c);
  }else{
    std::cout << "set environment variable \"TARTSYS\"" << std::endl;
    std::cout << "quit ROOT" << std::endl;      
    gROOT->ProcessLine(".q");
  } 

  AddIncludePath(install_dir);
  AddLinkedLibs();
  LoadModule(install_dir);

  //Base Style
  //  gROOT->SetStyle("Plain");
  gROOT->SetStyle("Modern");
  //  gROOT->SetStyle("Classic");

  //Force Style
  gStyle->SetHistFillColor(7);
  gStyle->SetHistFillStyle(3002);
  gStyle->SetHistLineColor(kBlue);
  gStyle->SetFuncColor(kRed);
  gStyle->SetFrameLineWidth(2);
  gStyle->SetPadGridX(1);
  gStyle->SetPadGridY(1);
  gStyle->SetCanvasColor(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetTitleStyle(0);
  gStyle->SetStatColor(0);
  gStyle->SetStatStyle(0);
  gStyle->SetStatX(0.9);  
  gStyle->SetStatY(0.9);  
  gStyle->SetPalette(1);
  gStyle->SetOptLogz(1);
  //  gStyle->SetOptTitle(0);
  gStyle->SetOptFit(1);
  gStyle->SetOptStat(1111111);
  gStyle->SetPadBorderMode(1);
  //  gStyle->SetOptDate(1);

  gStyle->SetLabelFont(132,"XYZ");
  gStyle->SetTitleFont(132,"XYZ");
  gStyle->SetTitleFont(132,"");
  gStyle->SetTextFont(132);
  gStyle->SetStatFont(132);
  
}
コード例 #23
0
ファイル: Module.cpp プロジェクト: aonorin/kaleido3d
	IModule * ModuleManager::FindModule(const char * moduleName)
	{
		std::string mName(moduleName);
		if (g_ModuleMap.find(moduleName) != g_ModuleMap.end())
		{
			return g_ModuleMap[mName];
		} 
		else
		{
			if(LoadModule(moduleName))
				return g_ModuleMap[mName];
		}
		return nullptr;
	}
コード例 #24
0
ファイル: CModules.cpp プロジェクト: Remscar/holly
bool CModules::Load( const char* strName )
{
	void* pLibrary = LoadModule( (m_strLocation + Holly::Platform::LibraryPretension() + "holly_" + strName + Holly::Platform::LibraryExtension()).c_str() );
	
	if ( !pLibrary ) pLibrary = LoadModule( strName );
	if ( !pLibrary ) return false;

	void* pFunction = Holly::Platform::FindFunction( pLibrary, "Holly_Module_Dynamic" );
	if ( !pFunction )
	{
		Holly::Errors::Add( "Invalid Module" );
		Holly::Platform::FreeLibrary( pLibrary );
		return false;
	}

	Module mod;
		mod.pInstance = pLibrary;
		mod.pModuleQuery = (fnModuleQuery)pFunction;

	m_Modules[ strName ] = mod;

	return true;
}
コード例 #25
0
ファイル: modmgr.c プロジェクト: ErisBlastar/osfree
unsigned long ModLoadExeModule(char *          pszName,
                               unsigned long   cbName,
                               char const *    pszModname,
                               unsigned long * phmod)
{
  int rc = 0;
  
  rc = OpenModule(pszName, cbName, pszModname, 1, phmod);

  if (rc) 
    return rc;
  
  rc = LoadModule(pszName, cbName, phmod);
  return rc;
コード例 #26
0
ファイル: WinApp.cpp プロジェクト: TrentSterling/D0G
//-----------------------------------------------------------------------------
// Create necessary interfaces
//-----------------------------------------------------------------------------
bool CSteamApplication::Create()
{
	FileSystem_SetErrorMode( FS_ERRORMODE_AUTO );

	char pFileSystemDLL[MAX_PATH];
	if ( FileSystem_GetFileSystemDLLName( pFileSystemDLL, MAX_PATH, m_bSteam ) != FS_OK )
		return false;
	
	FileSystem_SetupSteamInstallPath();

	// Add in the cvar factory
	AppModule_t cvarModule = LoadModule( VStdLib_GetICVarFactory() );
	AddSystem( cvarModule, CVAR_INTERFACE_VERSION );

	AppModule_t fileSystemModule = LoadModule( pFileSystemDLL );
	m_pFileSystem = (IFileSystem*)AddSystem( fileSystemModule, FILESYSTEM_INTERFACE_VERSION );
	if ( !m_pFileSystem )
	{
		Error( "Unable to load %s", pFileSystemDLL );
		return false;
	}

	return true;
}
コード例 #27
0
// start loading based on the vector of library names.  First success
// terminates the loading attempts.  Needed for CentOS6 and OpenCL.
// The Catalyst installer (at least in Catalyst 12.1) creates libOpenCL.so.1
// but no symbolic link to libOpenCL.so.  This symbolic link exists on other
// distributions where multi-step repackaging is required (build a .deb, run it)
bool DynamicLibraryModule::LoadModule(const std::vector<std::string>& names)
{
    bool    loaded = false;

    for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); it++)
    {
        loaded = LoadModule(*it);

        if (loaded)
        {
            return loaded;
        }
    }

    return loaded;
}
コード例 #28
0
//----------------------------------------------------------------------------
//  RunModule
HRESULT CMagpieApplication::RunModule(
  CMagpieModule           *   pSrcModule,
  LPCOLESTR                   lpszModuleID,
  CMagpieModuleComObject  **  ppRet)
{
  // load the module
  CComPtr<CMagpieModuleComObject> module;
  IF_FAILED_RET(LoadModule(pSrcModule, lpszModuleID, module.p));

  if (ppRet)
  {
    module.CopyTo(ppRet);
  }

  // and run
  return module->Run();
}
コード例 #29
0
//----------------------------------------------------------------------------
//  RunScriptAsModule
HRESULT CMagpieApplication::RunScriptAsModule(
  CMagpieModule           *   pSrcModule,
  LPCOLESTR                   lpszModuleID,
  LPCOLESTR                   lpszModuleSource,
  CMagpieModuleComObject  **  ppRet)
{
  // load the module
  CComPtr<CMagpieModuleComObject> module;
  IF_FAILED_RET(LoadModule(pSrcModule, lpszModuleID, lpszModuleSource, 9 == m_ScriptEngine.mJscriptVersion, module.p));

  if (ppRet)
  {
    module.CopyTo(ppRet);
  }

  // and run
  return module->Run();
}
コード例 #30
0
//----------------------------------------------------------------------------
//  RunModule
HRESULT CMagpieApplication::RunModule(
  CMagpieModule           *   pSrcModule,
  LPCOLESTR                   lpszModuleID,
  CMagpieModuleComObject  **  ppRet)
{
  ATLTRACE(_T("CMagpieApplication::RunModule %s\n"), lpszModuleID);
  // load the module
  CComPtr<CMagpieModuleComObject> module;
  IF_FAILED_RET(LoadModule(pSrcModule, lpszModuleID, NULL, 9 == m_ScriptEngine.mJscriptVersion, module.p));

  if (ppRet)
  {
    module.CopyTo(ppRet);
  }

  // and run
  return module->Run();
}