diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 8d4a233..e86a1de 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -27,10 +27,16 @@ #include #include "qrcodegen.h" -#ifdef QRCODEGEN_TEST - #define testable // Expose private functions -#else +#ifndef QRCODEGEN_TEST #define testable static // Keep functions private +#else + // Expose private functions + #ifndef __cplusplus + #define testable + #else + // Needed for const variables because they are treated as implicitly 'static' in C++ + #define testable extern + #endif #endif diff --git a/c/qrcodegen.h b/c/qrcodegen.h index ebb80d4..389c523 100644 --- a/c/qrcodegen.h +++ b/c/qrcodegen.h @@ -77,10 +77,6 @@ enum qrcodegen_Mask { /*---- Functions to generate QR Codes ----*/ -#ifdef __cplusplus -extern "C" { -#endif - /* * Encodes the given text string to a QR Code symbol, returning true if encoding succeeded. * If the data is too long to fit in any version in the given range @@ -144,7 +140,3 @@ int qrcodegen_getSize(const uint8_t qrcode[]); * If the given coordinates are out of bounds, then false (white) is returned. */ bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y); - -#ifdef __cplusplus -} -#endif