bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] lib/base64.h: wrap declarations in extern "C" scope when include


From: Carlo de Falco
Subject: [PATCH] lib/base64.h: wrap declarations in extern "C" scope when included from C++
Date: Mon, 30 Jul 2012 10:03:28 +0200

Hi,

In order to use base64.h in GNU/Octave we had to wrap the #include <"base64.h">
in extern "C" scope. We believe it would have been better if this had been done
upstream. Would it be possible to apply the patch below to lib/base64.h ?

Carlo

-----------------

diff --git a/lib/base64.h b/lib/base64.h
index e125d7e..b029987 100644
--- a/lib/base64.h
+++ b/lib/base64.h
@@ -24,6 +24,10 @@
 /* Get bool. */
 # include <stdbool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* This uses that the expression (n+(k-1))/k means the smallest
    integer >= n/k, i.e., the ceiling of n/k.  */
 # define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
@@ -57,4 +61,8 @@ extern bool base64_decode_alloc_ctx (struct 
base64_decode_context *ctx,
 #define base64_decode_alloc(in, inlen, out, outlen) \
         base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* BASE64_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]