Added VS checks around code block from Mark Sciabica that broke the mingw build
This commit is contained in:
parent
435f410bf8
commit
5d512b44c9
@ -654,40 +654,40 @@ static void appendInstallationLibraryFilePaths(osgDB::FilePathList& filepath)
|
|||||||
// 2. The directory that the dll that contains this function is in.
|
// 2. The directory that the dll that contains this function is in.
|
||||||
// For static builds, this will be the executable directory.
|
// For static builds, this will be the executable directory.
|
||||||
|
|
||||||
// Requires use of the GetModuleHandleEx() function which is available only on Windows XP or higher.
|
#if defined(_MSC_VER)
|
||||||
// In order to allow execution on older versions, we load the function dynamically from the library and
|
// Requires use of the GetModuleHandleEx() function which is available only on Windows XP or higher.
|
||||||
// use it only if it's available.
|
// In order to allow execution on older versions, we load the function dynamically from the library and
|
||||||
bool addedDllDirectory = false;
|
// use it only if it's available.
|
||||||
OSGDB_WINDOWS_FUNCT(PGET_MODULE_HANDLE_EX) pGetModuleHandleEx = reinterpret_cast<OSGDB_WINDOWS_FUNCT(PGET_MODULE_HANDLE_EX)>
|
OSGDB_WINDOWS_FUNCT(PGET_MODULE_HANDLE_EX) pGetModuleHandleEx = reinterpret_cast<OSGDB_WINDOWS_FUNCT(PGET_MODULE_HANDLE_EX)>
|
||||||
(GetProcAddress( GetModuleHandleA("kernel32.dll"), OSGDB_WINDOWS_FUNCT_STRING(GetModuleHandleEx)));
|
(GetProcAddress( GetModuleHandleA("kernel32.dll"), OSGDB_WINDOWS_FUNCT_STRING(GetModuleHandleEx)));
|
||||||
if( pGetModuleHandleEx )
|
if( pGetModuleHandleEx )
|
||||||
{
|
|
||||||
HMODULE thisModule = 0;
|
|
||||||
static char static_variable = 0; // Variable that is located in DLL address space.
|
|
||||||
|
|
||||||
if( pGetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, &static_variable, &thisModule) )
|
|
||||||
{
|
{
|
||||||
retval = OSGDB_WINDOWS_FUNCT(GetModuleFileName)(thisModule, path, size);
|
HMODULE thisModule = 0;
|
||||||
if (retval != 0 && retval < size)
|
static char static_variable = 0; // Variable that is located in DLL address space.
|
||||||
|
|
||||||
|
if( pGetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, &static_variable, &thisModule) )
|
||||||
{
|
{
|
||||||
filenamestring pathstr(path);
|
retval = OSGDB_WINDOWS_FUNCT(GetModuleFileName)(thisModule, path, size);
|
||||||
filenamestring dllDir(pathstr, 0,
|
if (retval != 0 && retval < size)
|
||||||
pathstr.find_last_of(OSGDB_FILENAME_TEXT("\\/")));
|
{
|
||||||
convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(dllDir), filepath);
|
filenamestring pathstr(path);
|
||||||
addedDllDirectory = true;
|
filenamestring dllDir(pathstr, 0,
|
||||||
|
pathstr.find_last_of(OSGDB_FILENAME_TEXT("\\/")));
|
||||||
|
convertStringPathIntoFilePathList(OSGDB_FILENAME_TO_STRING(dllDir), filepath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
osg::notify(osg::WARN) << "Could not get dll directory "
|
||||||
|
"using Win32 API. It will not be searched." << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::notify(osg::WARN) << "Could not get dll directory "
|
osg::notify(osg::WARN) << "Could not get dll module handle "
|
||||||
"using Win32 API. It will not be searched." << std::endl;
|
"using Win32 API. Dll directory will not be searched." << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
#endif
|
||||||
{
|
|
||||||
osg::notify(osg::WARN) << "Could not get dll module handle "
|
|
||||||
"using Win32 API. Dll directory will not be searched." << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. The system directory. Use the GetSystemDirectory function to
|
// 3. The system directory. Use the GetSystemDirectory function to
|
||||||
// get the path of this directory.
|
// get the path of this directory.
|
||||||
|
Loading…
Reference in New Issue
Block a user