mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
lib/CGameInterface.cpp: add MinGW workaround
MinGW returns all dynamic library functions as FARPROC, which need to be cast to actual signatures, and this casts emits -Wcast-function-type. So, silence it for GetProcAddress.
This commit is contained in:
@@ -297,6 +297,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-varargs") # emitted in fuzzylite headers, disabled
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-varargs") # emitted in fuzzylite headers, disabled
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pragmas") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||||
|
|||||||
@@ -49,12 +49,19 @@ std::shared_ptr<rett> createAny(const boost::filesystem::path & libpath, const s
|
|||||||
TGetNameFun getName = nullptr;
|
TGetNameFun getName = nullptr;
|
||||||
|
|
||||||
#ifdef VCMI_WINDOWS
|
#ifdef VCMI_WINDOWS
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
|
#endif
|
||||||
HMODULE dll = LoadLibraryW(libpath.c_str());
|
HMODULE dll = LoadLibraryW(libpath.c_str());
|
||||||
if (dll)
|
if (dll)
|
||||||
{
|
{
|
||||||
getName = (TGetNameFun)GetProcAddress(dll, "GetAiName");
|
getName = (TGetNameFun)GetProcAddress(dll, "GetAiName");
|
||||||
getAI = (TGetAIFun)GetProcAddress(dll, methodName.c_str());
|
getAI = (TGetAIFun)GetProcAddress(dll, methodName.c_str());
|
||||||
}
|
}
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
#else // !VCMI_WINDOWS
|
#else // !VCMI_WINDOWS
|
||||||
void *dll = dlopen(libpath.string().c_str(), RTLD_LOCAL | RTLD_LAZY);
|
void *dll = dlopen(libpath.string().c_str(), RTLD_LOCAL | RTLD_LAZY);
|
||||||
if (dll)
|
if (dll)
|
||||||
|
|||||||
Reference in New Issue
Block a user