Browse Source

The main part of the C++ support is the definition of __BEGIN_DECLS
and __END_DECLS in this file based on the __cplusplus define.

David McCullough 23 years ago
parent
commit
5882811b88
1 changed files with 8 additions and 3 deletions
  1. 8 3
      include/sys/cdefs.h

+ 8 - 3
include/sys/cdefs.h

@@ -20,9 +20,14 @@
 
 #endif
 
-/* No C++ */
-#define __BEGIN_DECLS
-#define __END_DECLS
+/* C++ needs to know that types and declarations are C, not C++.  */
+#ifdef  __cplusplus
+# define __BEGIN_DECLS  extern "C" {
+# define __END_DECLS    }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
 
 /* GNUish things */
 #define __CONSTVALUE