javascript: fix swig generation of node.js api
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 29 Apr 2014 17:44:09 +0000 (18:44 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 29 Apr 2014 17:44:09 +0000 (18:44 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
api/gpio.h
api/i2c.h
api/maa.h
api/pwm.h
src/javascript/CMakeLists.txt

index 0298779..0779d2f 100644 (file)
  *
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdio.h>
 
 #include "maa.h"
@@ -116,3 +120,7 @@ int maa_gpio_read(maa_gpio_context *dev);
  * @return maa result type
  */
 maa_result_t maa_gpio_write(maa_gpio_context *dev, int value);
+
+#ifdef __cplusplus
+}
+#endif
index e0c46cc..8ff156a 100644 (file)
--- a/api/i2c.h
+++ b/api/i2c.h
  *
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -116,3 +120,7 @@ void maa_i2c_address(maa_i2c_context* dev, int address);
  *  @param dev the i2c context
  */
 void maa_i2c_stop(maa_i2c_context* dev);
+
+#ifdef __cplusplus
+}
+#endif
index fa0c5c3..fe4dd86 100644 (file)
--- a/api/maa.h
+++ b/api/maa.h
  *
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum {
     MAA_SUCCESS                              =  0,
     MAA_ERROR_FEATURE_NOT_IMPLEMENTED        =  1,
@@ -52,3 +56,7 @@ typedef enum {
  * @return version string from version.h
  */
 const char* maa_get_version();
+
+#ifdef __cplusplus
+}
+#endif
index 0c66f1e..54cce8e 100644 (file)
--- a/api/pwm.h
+++ b/api/pwm.h
  *
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdio.h>
 #include <fcntl.h>
 
@@ -92,3 +96,7 @@ void maa_pwm_enable(maa_pwm_context* pwm, int enable);
  /** Close and unexport the PWM pin.
  */
 void maa_pwm_close(maa_pwm_context* pwm);
+
+#ifdef __cplusplus
+}
+#endif
index c8b6943..f6c3ef2 100644 (file)
@@ -14,8 +14,9 @@ include_directories(
 )
 
 SET_SOURCE_FILES_PROPERTIES(maajs.i PROPERTIES SWIG_FLAGS "-node")
+SET_SOURCE_FILES_PROPERTIES(maajs.i PROPERTIES CPLUSPLUS ON)
 
-SWIG_ADD_MODULE(maajs javascript ${maa_LIB_SRCS})
+SWIG_ADD_MODULE(maajs javascript maajs.i ${maa_LIB_SRCS})
 SWIG_LINK_LIBRARIES(maajs ${NODE_LIBRARIES})
 
 set_target_properties(maajs PROPERTIES