Compilation error with MinGW

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>
#include <dbghelp.h>


typedef BOOL (WINAPI

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.


-- Sly.

diff --git a/lib/Support/Windows/
index d38f197..b4c8f1b 100644
--- a/lib/Support/Windows/
+++ b/lib/Support/Windows/
@@ -31,7 +31,16 @@ using namespace sys;
//=== and must not be UNIX code.

+#if defined(__MINGW32__) and !defined(_WIN64)
+typedef BOOL (WINAPI
+static const char* sEnumerateLoadedModules = "EnumerateLoadedModules";
+typedef DWORD ModuleOffset;
typedef BOOL (WINAPI
+static const char* sEnumerateLoadedModules = "EnumerateLoadedModules64";
+typedef DWORD64 ModuleOffset;

Which mingw distribution exactly do you use?

I use the one from, installed by the recommended way with


This is an outdated version, please download mingw-w64 from

Can we somehow distinguish between mingw and mingw-w64 at configure
time and error properly?

Easy to do at build time, something like

#include <stdlib.h>
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
#error not supported. Please use Mingw-w64.

Probably could go into CMakeLists.txt somehow.

Got it, thank you.