From 70e44b846ceaf9eebc336b12a07406c3a418a5c3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 20 Jun 2014 04:57:46 +0200 Subject: Enable compatibility w/ gcc/mingw64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These changes enable gcc/mingw64 compatibility. Besides adding fixes of my own, the following changes were considered: https://github.com/parasti/OculusSDK-MinGW/commit/8fa94f4cc1d7e9d34a1908a4d69df52e5d998a20 https://github.com/parasti/OculusSDK-MinGW/commit/b4681523477b15bea94379eb11b17be9daa7ac17 https://github.com/larspensjo/OculusSDK-MinGW/commit/213118fdc1798a54b4efb930c3427b694abd8b31 Big KUDOS to - Jānis Rūcis aka 'parasti' - Lars Pensjö aka 'larspensjo' --- LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp') diff --git a/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp b/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp index 91a5e31..1779fb0 100644 --- a/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp +++ b/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp @@ -821,7 +821,7 @@ unsigned WINAPI Thread_Win32StartFn(void * phandle) // Ensure that ThreadId is assigned once thread is running, in case // beginthread hasn't filled it in yet. - pthread->IdValue = (ThreadId)::GetCurrentThreadId(); + pthread->IdValue = (ThreadId)(intptr_t)::GetCurrentThreadId(); // should be: typedef intptr_t ThreadId; DWORD result = pthread->PRun(); // Signal the thread as done and release it atomically. @@ -953,7 +953,8 @@ bool Thread::MSleep(unsigned msecs) void Thread::SetThreadName( const char* name ) { -#if !defined(OVR_BUILD_SHIPPING) || defined(OVR_BUILD_PROFILING) + // MinGW does not support SEH exceptions, hence CPP: && defined(OVR_CC_MSVC) +#if ( !defined(OVR_BUILD_SHIPPING) || defined(OVR_BUILD_PROFILING) ) && defined(OVR_CC_MSVC) // Looks ugly, but it is the recommended way to name a thread. typedef struct tagTHREADNAME_INFO { DWORD dwType; // Must be 0x1000 @@ -995,7 +996,7 @@ int Thread::GetCPUCount() // comparison purposes. ThreadId GetCurrentThreadId() { - return (ThreadId)::GetCurrentThreadId(); + return (ThreadId)(intptr_t)::GetCurrentThreadId(); // should be: typedef intptr_t ThreadId; } } // OVR -- cgit v1.2.3