From 4b174f6ed96d82dc8c76209057626abc8ceea338 Mon Sep 17 00:00:00 2001 From: Christian Starkjohann Date: Tue, 12 Nov 2013 12:01:32 +0100 Subject: Added #ifdef and extern "C" so that usbdrv.h / usbdrv.c can be included from C++ module. --- usbdrv/usbdrv.h | 19 +++++++++++++++++-- 1 file 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 ---------------------------- */ /* ------------------------------------------------------------------------- */ -- cgit v1.2.3