[llvm-dev] Compilation error with MinGW

Slycelote via llvm-dev llvm-dev at lists.llvm.org
Sun Aug 30 12:08:44 PDT 2015


Got it, thank you.

Sly.

On 30.08.2015 21:25, Yaron Keren wrote:
> This is an outdated version, please download mingw-w64 from
> https://sourceforge.net/projects/mingw-w64/
>
> 2015-08-30 20:57 GMT+03:00 Slycelote <slycelot at yandex.ru>:
>
>> I use the one from mingw.org, installed by the recommended way with
>> mingw-get-setup.exe.
>>
>> Sly.
>>
>> On 30.08.2015 06:10, Yaron Keren wrote:
>>> Which mingw distribution exactly do you use?
>>>
>>> 2015-08-30 0:46 GMT+03:00 Slycelote via llvm-dev <
>> llvm-dev at lists.llvm.org>:
>>>> Hi all,
>>>>
>>>> I'm hitting the same problem as in this[1] thread. I use release_37
>>>> branch on 64-bit Windows 7.
>>>> The problem is here:
>>>>
>>>> #ifdef __MINGW32__
>>>>  #include <imagehlp.h>
>>>> #else
>>>>  #include <dbghelp.h>
>>>> #endif
>>>>
>>>> <skip>
>>>>
>>>> typedef BOOL (WINAPI
>>>> *fpEnumerateLoadedModules)(HANDLE,PENUMLOADED_MODULES_CALLBACK64,PVOID);
>>>>
>>>> imagehlp.h doesn't define PENUMLOADED_MODULES_CALLBACK64 type.
>>>> I fixed it on my side by the patch in the bottom of this email, but I
>>>> don't know if it's the right approach in general.
>>>>
>>>> [1] http://comments.gmane.org/gmane.comp.compilers.clang.user/709
>>>>
>>>> -- Sly.
>>>>
>>>>
>>>> diff --git a/lib/Support/Windows/DynamicLibrary.inc
>>>> b/lib/Support/Windows/DynamicLibrary.inc
>>>> index d38f197..b4c8f1b 100644
>>>> --- a/lib/Support/Windows/DynamicLibrary.inc
>>>> +++ b/lib/Support/Windows/DynamicLibrary.inc
>>>> @@ -31,7 +31,16 @@ using namespace sys;
>>>>  //===          and must not be UNIX code.
>>>>
>>>>
>> //===----------------------------------------------------------------------===//
>>>> +#if defined(__MINGW32__) and !defined(_WIN64)
>>>> +typedef BOOL (WINAPI
>>>> *fpEnumerateLoadedModules)(HANDLE,PENUMLOADED_MODULES_CALLBACK,PVOID);
>>>> +static const char* sEnumerateLoadedModules = "EnumerateLoadedModules";
>>>> +typedef DWORD ModuleOffset;
>>>> +#else
>>>>  typedef BOOL (WINAPI
>>>> *fpEnumerateLoadedModules)(HANDLE,PENUMLOADED_MODULES_CALLBACK64,PVOID);
>>>> +static const char* sEnumerateLoadedModules =
>> "EnumerateLoadedModules64";
>>>> +typedef DWORD64 ModuleOffset;
>>>> +#endif
>>>> +
>>>>  static fpEnumerateLoadedModules fEnumerateLoadedModules;
>>>>  static DenseSet<HMODULE> *OpenedHandles;
>>>>
>>>> @@ -39,13 +48,13 @@ static bool loadDebugHelp(void) {
>>>>    HMODULE hLib = ::LoadLibraryW(L"Dbghelp.dll");
>>>>    if (hLib) {
>>>>      fEnumerateLoadedModules = (fpEnumerateLoadedModules)
>>>> -      ::GetProcAddress(hLib, "EnumerateLoadedModules64");
>>>> +      ::GetProcAddress(hLib, sEnumerateLoadedModules);
>>>>    }
>>>>    return fEnumerateLoadedModules != 0;
>>>>  }
>>>>
>>>>  static BOOL CALLBACK
>>>> -ELM_Callback(WIN32_ELMCB_PCSTR ModuleName, DWORD64 ModuleBase,
>>>> +ELM_Callback(WIN32_ELMCB_PCSTR ModuleName, ModuleOffset ModuleBase,
>>>>               ULONG ModuleSize, PVOID UserContext) {
>>>>    OpenedHandles->insert((HMODULE)ModuleBase);
>>>>    return TRUE;
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> llvm-dev at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>
>>



More information about the llvm-dev mailing list