From d5c06b6b13458364657b32835f25db1e7082855e Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周三, 01 5月 2013 18:31:23 +0800
Subject: [PATCH] Contributed patch: handling c++, non GCC compiler

---
 examples/common/scpi-def.h |    8 ++++++++
 libscpi/inc/scpi/ieee488.h |    7 +++++++
 libscpi/src/utils.h        |    4 ++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/examples/common/scpi-def.h b/examples/common/scpi-def.h
index 905aaa4..7de40e8 100644
--- a/examples/common/scpi-def.h
+++ b/examples/common/scpi-def.h
@@ -3,6 +3,10 @@
 
 #include "scpi/scpi.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 extern scpi_t scpi_context;
 
 size_t SCPI_Write(scpi_t * context, const char * data, size_t len);
@@ -15,5 +19,9 @@
 
 scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context);
 
+#ifdef  __cplusplus
+}
+#endif
+
 #endif // __SCPI_DEF_H_
 
diff --git a/libscpi/inc/scpi/ieee488.h b/libscpi/inc/scpi/ieee488.h
index b3693a1..f9c02ce 100644
--- a/libscpi/inc/scpi/ieee488.h
+++ b/libscpi/inc/scpi/ieee488.h
@@ -39,6 +39,10 @@
 
 #include "scpi/types.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 scpi_result_t SCPI_CoreCls(scpi_t * context);
 scpi_result_t SCPI_CoreEse(scpi_t * context);
 scpi_result_t SCPI_CoreEseQ(scpi_t * context);
@@ -79,6 +83,9 @@
 void SCPI_RegSetBits(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t bits);
 void SCPI_RegClearBits(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t bits);
 
+#ifdef  __cplusplus
+}
+#endif
 
 #endif	/* SCPI_IEEE488_H */
 
diff --git a/libscpi/src/utils.h b/libscpi/src/utils.h
index e4f4137..6d3528f 100644
--- a/libscpi/src/utils.h
+++ b/libscpi/src/utils.h
@@ -45,7 +45,11 @@
 extern "C" {
 #endif
 
+#if defined(__GNUC__) && (__GNUC__ >= 4)
     #define LOCAL __attribute__((visibility ("hidden")))
+#else
+    #define LOCAL
+#endif
 
     char * strnpbrk(const char *str, size_t size, const char *set) LOCAL;
     bool_t compareStr(const char * str1, size_t len1, const char * str2, size_t len2) LOCAL;

--
Gitblit v1.9.1