Skip to content

Commit b49446d

Browse files
committed
workaround cast-function-type
1 parent 3ba48b4 commit b49446d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

libs/common/src/System_Win32.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,20 @@ static HRESULT mySHGetKnownFolderPath(REFKNOWNFOLDERID rfid, std::string& path)
5959
if(!gShell32DLLInst)
6060
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
6161

62+
#if __GNUC__ >= 9
63+
#pragma GCC diagnostic push
64+
#pragma GCC diagnostic ignored "-Wcast-function-type"
65+
// error: cast between incompatible function types from
66+
// 'FARPROC' {aka 'int (__attribute__((stdcall)) *)()'}
67+
// to
68+
// 'LPSHGetKnownFolderPath' {aka 'long int (__attribute__((stdcall)) *)(const GUID&, long unsigned int, void*, wchar_t**)'}
69+
// [-Werror=cast-function-type]
70+
#endif
6271
if(gShell32DLLInst && !gSHGetKnownFolderPath)
6372
gSHGetKnownFolderPath = (LPSHGetKnownFolderPath)GetProcAddress(gShell32DLLInst, "SHGetKnownFolderPath");
73+
#if __GNUC__ >= 9
74+
#pragma GCC diagnostic pop
75+
#endif
6476

6577
if(gSHGetKnownFolderPath)
6678
retval = gSHGetKnownFolderPath(rfid, KF_FLAG_CREATE, nullptr, &ppszPath);

0 commit comments

Comments
 (0)