From 99247910b940e4f47728c3c73984c393d1dd48d5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 19 Nov 2018 16:12:14 +0100 Subject: [PATCH] Declare SHDefExtractIcon() if it's missing from (MinGW) headers At least the MinGW 5.3 used for AppVeyor builds doesn't declare this function, so provide its declaration ourselves to fix MinGW build after the recent changes. --- src/msw/artmsw.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/msw/artmsw.cpp b/src/msw/artmsw.cpp index 0d49683846..514912d86e 100644 --- a/src/msw/artmsw.cpp +++ b/src/msw/artmsw.cpp @@ -31,6 +31,27 @@ #define wxHAS_SHGetStockIconInfo #endif +// MinGW headers don't always define this symbol (up to at least 5.3 version), +// so do it ourselves. +// +// Note that at least there is no need for run-time loading here, as it's +// available since XP. +#ifndef SHDefExtractIcon + +#ifdef UNICODE +extern "C" HRESULT wxSTDCALL +SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, + HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize); +#define SHDefExtractIcon SHDefExtractIconW +#else // !UNICODE +extern "C" HRESULT wxSTDCALL +SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags, + HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize); +#define SHDefExtractIcon SHDefExtractIconA +#endif // UNICODE/!UNICODE + +#endif // !defined(SHDefExtractIcon) + namespace {