summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorJohannes Totz <jtotz@ic.ac.uk>2011-01-24 18:11:52 +0000
committerIvan Maidanski <ivmai@mail.ru>2015-05-11 18:57:42 +0300
commit6ab1b8a4b1523dfd0f78acce4419ce70ced7d7f9 (patch)
treef23bff7ee0ad45915f11ea3df1c4ab680c5e2b28 /misc.c
parenta347f728c38f7dcda65c657d8f6255e8ad4742b0 (diff)
downloadbdwgc-6ab1b8a4b1523dfd0f78acce4419ce70ced7d7f9.tar.gz
gc_init() is a better place for this warning
Conflicts: misc.c win32_threads.c
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 6c01404e..8145890f 100644
--- a/misc.c
+++ b/misc.c
@@ -852,6 +852,33 @@ GC_API void GC_CALL GC_init(void)
# else
initial_heap_sz = (word)MINHINCR;
# endif
+
+#ifdef GC_DEBUG
+#ifndef _WIN64
+ {
+ // wow64: running 32-bit-gc on 64-bit-sys is broken!
+ // code copied from msdn docs example
+ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
+ LPFN_ISWOW64PROCESS fnIsWow64Process = 0;
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandleA("kernel32"), "IsWow64Process");
+ if (NULL != fnIsWow64Process)
+ {
+ BOOL bIsWow64 = FALSE;
+ if (fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
+ {
+ if (bIsWow64)
+ MessageBoxA(NULL,
+ "This program uses the BDWGC garbage collector compiled for 32-bit "
+ "but running on a 64-bit version of Windows.\n"
+ "This is known to be broken due to a design flaw in Windows itself! Expect erratic behaviour...",
+ "32-bit program running on 64-bit system",
+ MB_ICONWARNING | MB_OK);
+ }
+ }
+ }
+#endif
+#endif
+
DISABLE_CANCEL(cancel_state);
/* Note that although we are nominally called with the */
/* allocation lock held, the allocation lock is now */