Minor fixes to Windows build to improve header include order resiliency (#126)
authorJesse Natalie <jenatali@microsoft.com>
Fri, 9 Oct 2020 00:26:00 +0000 (17:26 -0700)
committerGitHub <noreply@github.com>
Fri, 9 Oct 2020 00:26:00 +0000 (17:26 -0700)
* Rearrange includes in icd_windows.c to ensure DXGI.h has INITGUID defined when it's included

* Fix extern "C" usage in Windows build

loader/windows/icd_windows.c
loader/windows/icd_windows.h
loader/windows/icd_windows_apppackage.cpp

index 25f1b9b..19a0e7a 100644 (file)
@@ -16,6 +16,8 @@
  * OpenCL is a trademark of Apple Inc. used under license by Khronos.
  */
 
+#include <initguid.h>
+
 #include "icd.h"
 #include "icd_windows.h"
 #include "icd_windows_hkr.h"
@@ -25,7 +27,6 @@
 #include <windows.h>
 #include <winreg.h>
 
-#include <initguid.h>
 #include <dxgi.h>
 typedef HRESULT (WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID, void **);
 
index 48bbf13..2a283d3 100644 (file)
 #include <stdbool.h>
 #include <windows.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 extern const LUID ZeroLuid;
 
 BOOL adapterAdd(const char* szName, LUID luid);
 
 // Do not free the memory returned by this function.
 const char* getOpenCLRegKeyName(void);
+
+#ifdef __cplusplus
+}
+#endif
index 96a0bb2..b305c5d 100644 (file)
  * OpenCL is a trademark of Apple Inc. used under license by Khronos.
  */
 
-extern "C"
-{
 #include "icd.h"
 #include "icd_windows.h"
-}
 
 #ifdef OPENCL_ICD_LOADER_DISABLE_OPENCLON12