git » libjio » commit b903b5e

If we want the library to be linked against C++ source, we have to tell the compiler so, because of C++ name mangling.

author Alberto Bertogli
2004-04-30 13:43:17 UTC
committer Alberto Bertogli
2007-07-15 12:43:37 UTC
parent 4e2b2dba620d98a5ecc03dd49bb7324c735f9b4b

If we want the library to be linked against C++ source, we have to tell the compiler so, because of C++ name mangling.

If we want the library to be linked against C++ source, we have to tell the
compiler so, because of C++ name mangling.

This patch adds the conditional "extern C" in the header to do so, and allows
the library to be used inside C++.

libjio.h +9 -0

diff --git a/libjio.h b/libjio.h
index 6f04871..8fb6b8b 100644
--- a/libjio.h
+++ b/libjio.h
@@ -12,6 +12,10 @@
 #include <sys/uio.h>
 #include <pthread.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 /* logical structures */
 struct jfs {
@@ -101,5 +105,10 @@ int jfsck(char *name, struct jfsck_result *res);
 #define J_ENOJOURNAL	2	/* no journal associated */
 #define J_ENOMEM	3	/* no enough free memory */
 
+
+#ifdef __cplusplus
+} /* from extern "C" avobe */
+#endif
+
 #endif