rcgoodfellow

Fixes for headers on Linux

Discussion created by rcgoodfellow on Aug 6, 2014

Hi Guys,


I propose the following changes to your GPA headers to be a bit more status quo under Linux. The following are git diffs that show the changes. In GPUPerfAPI.h a conditional is added for C++ that specifies extern "C" for linkage, in GPUPerfAPITypes.h the macro _LINUX is changed to __linux__ to enable proper OS detection.


~ ry


--- a/GPUPerfAPI.h.original

+++ b/GPUPerfAPI.h.new

@@ -20,7 +20,11 @@

          #define GPALIB_DECL __declspec( dllimport )

       #endif

    #else //_LINUX

-      #define GPALIB_DECL extern

+      #ifdef __cplusplus

+         #define GPALIB_DECL extern "C"

+      #else

+         #define GPALIB_DECL extern

+      #endif

    #endif

#endif


--- a/GPUPerfAPITypes.h.original

+++ b/GPUPerfAPITypes.h.new

@@ -31,7 +31,7 @@ typedef gpa_uint8 bool;

#endif

#endif // _WIN32

 

-#ifdef _LINUX

+#ifdef __linux__

 

#ifdef GPALIB_DECL

#else

@@ -68,7 +68,7 @@ typedef gpa_uint8 bool;

#define strcpy_s(dst, ndst, src) strcpy(dst, src)

#define strtok_s(a, b, c) strtok(a, b)

 

-#endif // _LINUX

+#endif // __linux__

Outcomes