From 061a96e54c9ddc7a4141a364b60fd001d27cee30 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 8 Jan 2016 14:04:23 -0800 Subject: Fix building of GCSample on x86 via the standalone VS project --- src/gc/env/gcenv.base.h | 2 +- src/gc/sample/GCSample.vcxproj | 4 ++-- src/gc/sample/gcenv.ee.cpp | 2 +- src/gc/sample/gcenv.windows.cpp | 18 ++++++++++++------ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h index b7dbd84c5c..791648fe8a 100644 --- a/src/gc/env/gcenv.base.h +++ b/src/gc/env/gcenv.base.h @@ -82,7 +82,7 @@ inline HRESULT HRESULT_FROM_WIN32(unsigned long x) #define TRUE true #define FALSE false -#define CALLBACK +#define CALLBACK __stdcall #define FORCEINLINE inline #define INFINITE 0xFFFFFFFF diff --git a/src/gc/sample/GCSample.vcxproj b/src/gc/sample/GCSample.vcxproj index eefca17fb3..b196e1f34c 100644 --- a/src/gc/sample/GCSample.vcxproj +++ b/src/gc/sample/GCSample.vcxproj @@ -50,7 +50,7 @@ Use Level3 Disabled - WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + WIN32;_X86_;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) true common.h .;..;..\env @@ -67,7 +67,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + WIN32;_X86_;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) true .;..;..\env diff --git a/src/gc/sample/gcenv.ee.cpp b/src/gc/sample/gcenv.ee.cpp index a1a0360f20..e17bb834fa 100644 --- a/src/gc/sample/gcenv.ee.cpp +++ b/src/gc/sample/gcenv.ee.cpp @@ -230,7 +230,7 @@ bool FinalizerThread::HaveExtraWorkForFinalizer() return false; } -bool PalStartBackgroundGCThread(BackgroundCallback callback, void* pCallbackContext) +bool REDHAWK_PALAPI PalStartBackgroundGCThread(BackgroundCallback callback, void* pCallbackContext) { // TODO: Implement for background GC return false; diff --git a/src/gc/sample/gcenv.windows.cpp b/src/gc/sample/gcenv.windows.cpp index c9f0edb1f2..6fbc21ab14 100644 --- a/src/gc/sample/gcenv.windows.cpp +++ b/src/gc/sample/gcenv.windows.cpp @@ -366,10 +366,15 @@ struct GCThreadStubParam }; // GC thread stub to convert GC thread function to an OS specific thread function -static DWORD GCThreadStub(void* param) +static DWORD __stdcall GCThreadStub(void* param) { GCThreadStubParam *stubParam = (GCThreadStubParam*)param; - stubParam->GCThreadFunction(stubParam->GCThreadParam); + GCThreadFunction function = stubParam->GCThreadFunction; + void* threadParam = stubParam->GCThreadParam; + + delete stubParam; + + function(threadParam); return 0; } @@ -384,15 +389,16 @@ static DWORD GCThreadStub(void* param) bool GCToOSInterface::CreateThread(GCThreadFunction function, void* param, GCThreadAffinity* affinity) { DWORD thread_id; - GCThreadStubParam stubParam; - stubParam.GCThreadFunction = function; - stubParam.GCThreadParam = param; + GCThreadStubParam* stubParam = new (nothrow) GCThreadStubParam(); + stubParam->GCThreadFunction = function; + stubParam->GCThreadParam = param; - HANDLE gc_thread = ::CreateThread(NULL, 0, GCThreadStub, &stubParam, CREATE_SUSPENDED, &thread_id); + HANDLE gc_thread = ::CreateThread(NULL, 0, GCThreadStub, stubParam, CREATE_SUSPENDED, &thread_id); if (!gc_thread) { + delete stubParam; return false; } -- cgit v1.2.3