mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +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:
@@ -49,12 +49,19 @@ std::shared_ptr<rett> createAny(const boost::filesystem::path & libpath, const s
|
||||
TGetNameFun getName = nullptr;
|
||||
|
||||
#ifdef VCMI_WINDOWS
|
||||
#ifdef __MINGW32__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif
|
||||
HMODULE dll = LoadLibraryW(libpath.c_str());
|
||||
if (dll)
|
||||
{
|
||||
getName = (TGetNameFun)GetProcAddress(dll, "GetAiName");
|
||||
getAI = (TGetAIFun)GetProcAddress(dll, methodName.c_str());
|
||||
}
|
||||
#ifdef __MINGW32__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#else // !VCMI_WINDOWS
|
||||
void *dll = dlopen(libpath.string().c_str(), RTLD_LOCAL | RTLD_LAZY);
|
||||
if (dll)
|
||||
|
||||
Reference in New Issue
Block a user