aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Starkjohann <cs+github@obdev.at>2013-11-12 12:01:32 +0100
committerChristian Starkjohann <cs+github@obdev.at>2013-11-12 12:01:32 +0100
commit4b174f6ed96d82dc8c76209057626abc8ceea338 (patch)
treec396523e8ab9b7d2beaf3d051b02334656604884
parent6ae2e9dc5f958113bb4eff04a64666bc889d2735 (diff)
downloadv-usb-4b174f6ed96d82dc8c76209057626abc8ceea338.tar.gz
v-usb-4b174f6ed96d82dc8c76209057626abc8ceea338.tar.bz2
v-usb-4b174f6ed96d82dc8c76209057626abc8ceea338.zip
Added #ifdef and extern "C" so that usbdrv.h / usbdrv.c can be included from C++ module.
-rw-r--r--usbdrv/usbdrv.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/usbdrv/usbdrv.h b/usbdrv/usbdrv.h
index 3fe84d5..113854e 100644
--- a/usbdrv/usbdrv.h
+++ b/usbdrv/usbdrv.h
@@ -9,8 +9,6 @@
#ifndef __usbdrv_h_included__
#define __usbdrv_h_included__
-#include "usbconfig.h"
-#include "usbportability.h"
/*
Hardware Prerequisites:
@@ -117,6 +115,23 @@ USB messages, even if they address another (low-speed) device on the same bus.
*/
+
+#ifdef __cplusplus
+// This header should be included as C-header from C++ code. However if usbdrv.c
+// is incorporated into a C++ module with an include, function names are mangled
+// and this header must be parsed as C++ header, too. External modules should be
+// treated as C, though, because they are compiled separately as C code.
+extern "C" {
+#endif
+
+#include "usbconfig.h"
+#include "usbportability.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+
/* ------------------------------------------------------------------------- */
/* --------------------------- Module Interface ---------------------------- */
/* ------------------------------------------------------------------------- */