本文整理汇总了C++中DllLoader::LoadSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ DllLoader::LoadSymbol方法的具体用法?C++ DllLoader::LoadSymbol怎么用?C++ DllLoader::LoadSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DllLoader
的用法示例。
在下文中一共展示了DllLoader::LoadSymbol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BeginAtlas
bool BeginAtlas(const CmdLineArgs& args, const DllLoader& dll)
{
// Load required symbols from the DLL
try
{
dll.LoadSymbol("Atlas_StartWindow", Atlas_StartWindow);
dll.LoadSymbol("Atlas_SetMessagePasser", Atlas_SetMessagePasser);
dll.LoadSymbol("Atlas_SetDataDirectory", Atlas_SetDataDirectory);
dll.LoadSymbol("Atlas_SetConfigDirectory", Atlas_SetConfigDirectory);
dll.LoadSymbol("Atlas_GLSetCurrent", Atlas_GLSetCurrent);
dll.LoadSymbol("Atlas_GLSwapBuffers", Atlas_GLSwapBuffers);
dll.LoadSymbol("Atlas_NotifyEndOfFrame", Atlas_NotifyEndOfFrame);
dll.LoadSymbol("Atlas_DisplayError", Atlas_DisplayError);
dll.LoadSymbol("Atlas_ReportError", Atlas_ReportError);
dll.LoadSymbol("ShareableMalloc", ShareableMallocFptr);
dll.LoadSymbol("ShareableFree", ShareableFreeFptr);
}
catch (PSERROR_DllLoader&)
{
debug_warn(L"Failed to initialise DLL");
return false;
}
// Construct a message passer for communicating with Atlas
// (here so that its scope lasts beyond the game thread)
MessagePasserImpl msgPasser;
AtlasMessage::g_MessagePasser = &msgPasser;
// Pass our message handler to Atlas
Atlas_SetMessagePasser(&msgPasser);
// Tell Atlas the location of the data directory
const Paths paths(args);
Atlas_SetDataDirectory(paths.RData().string().c_str());
// Tell Atlas the location of the user config directory
Atlas_SetConfigDirectory(paths.Config().string().c_str());
// Run the engine loop in a new thread
pthread_t engineThread;
pthread_create(&engineThread, NULL, RunEngine, reinterpret_cast<void*>(const_cast<CmdLineArgs*>(&args)));
// Start Atlas UI on main thread
// (required for wxOSX/Cocoa compatibility - see http://trac.wildfiregames.com/ticket/500)
Atlas_StartWindow(L"ScenarioEditor");
// Wait for the engine to exit
pthread_join(engineThread, NULL);
// TODO: delete all remaining messages, to avoid memory leak warnings
// Restore main thread
ThreadUtil::SetMainThread();
// Clean up
AtlasView::DestroyViews();
AtlasMessage::g_MessagePasser = NULL;
return true;
}
示例2: TryLoadDLL
bool TryLoadDLL()
{
if (!dll.LoadDLL())
{
LOGERROR("Failed to load COLLADA conversion DLL");
return false;
}
try
{
dll.LoadSymbol("set_logger", set_logger);
dll.LoadSymbol("set_skeleton_definitions", set_skeleton_definitions);
dll.LoadSymbol("convert_dae_to_pmd", convert_dae_to_pmd);
dll.LoadSymbol("convert_dae_to_psa", convert_dae_to_psa);
}
catch (PSERROR_DllLoader&)
{
LOGERROR("Failed to load symbols from COLLADA conversion DLL");
dll.Unload();
return false;
}
return true;
}
示例3: Convert
bool Convert(const VfsPath& daeFilename, const VfsPath& pmdFilename, CColladaManager::FileType type)
{
// To avoid always loading the DLL when it's usually not going to be
// used (and to do the same on Linux where delay-loading won't help),
// and to avoid compile-time dependencies (because it's a minor pain
// to get all the right libraries to build the COLLADA DLL), we load
// it dynamically when it is required, instead of using the exported
// functions and binding at link-time.
if (! dll.IsLoaded())
{
if (! dll.LoadDLL())
{
LOGERROR(L"Failed to load COLLADA conversion DLL");
return false;
}
try
{
dll.LoadSymbol("set_logger", set_logger);
dll.LoadSymbol("set_skeleton_definitions", set_skeleton_definitions);
dll.LoadSymbol("convert_dae_to_pmd", convert_dae_to_pmd);
dll.LoadSymbol("convert_dae_to_psa", convert_dae_to_psa);
}
catch (PSERROR_DllLoader&)
{
LOGERROR(L"Failed to load symbols from COLLADA conversion DLL");
dll.Unload();
return false;
}
VfsPath skeletonPath("art/skeletons/skeletons.xml");
// Set the filename for the logger to report
set_logger(ColladaLog, static_cast<void*>(&skeletonPath));
CVFSFile skeletonFile;
if (skeletonFile.Load(g_VFS, skeletonPath) != PSRETURN_OK)
{
LOGERROR(L"Failed to read skeleton definitions");
dll.Unload();
return false;
}
int ok = set_skeleton_definitions((const char*)skeletonFile.GetBuffer(), (int)skeletonFile.GetBufferSize());
if (ok < 0)
{
LOGERROR(L"Failed to load skeleton definitions");
dll.Unload();
return false;
}
// TODO: the cached PMD/PSA files should probably be invalidated when
// the skeleton definition file is changed, else people will get confused
// as to why it's not picking up their changes
}
// Set the filename for the logger to report
set_logger(ColladaLog, const_cast<void*>(static_cast<const void*>(&daeFilename)));
// We need to null-terminate the buffer, so do it (possibly inefficiently)
// by converting to a CStr
CStr daeData;
{
CVFSFile daeFile;
if (daeFile.Load(g_VFS, daeFilename) != PSRETURN_OK)
return false;
daeData = daeFile.GetAsString();
}
// Do the conversion into a memory buffer
WriteBuffer writeBuffer;
switch (type)
{
case CColladaManager::PMD: convert_dae_to_pmd(daeData.c_str(), ColladaOutput, &writeBuffer); break;
case CColladaManager::PSA: convert_dae_to_psa(daeData.c_str(), ColladaOutput, &writeBuffer); break;
}
// don't create zero-length files (as happens in test_invalid_dae when
// we deliberately pass invalid XML data) because the VFS caching
// logic warns when asked to load such.
if (writeBuffer.Size())
{
Status ret = g_VFS->CreateFile(pmdFilename, writeBuffer.Data(), writeBuffer.Size());
ENSURE(ret == INFO::OK);
}
return true;
}