From 1ed15e287c9ca441e7afcb3dc378bc1a9d14c0ca Mon Sep 17 00:00:00 2001
From: "Nicolas \"Pixel\" Noble" <pixel@nobis-crew.org>
Date: Tue, 9 Jun 2015 02:24:35 +0200
Subject: [PATCH] Properly exporting our C functions to C++.

Also properly including our headers from public headers using <>
---
 include/grpc/byte_buffer.h         | 8 ++++++++
 include/grpc/byte_buffer_reader.h  | 8 ++++++++
 include/grpc/census.h              | 8 ++++++++
 include/grpc/grpc_security.h       | 4 ++--
 include/grpc/support/tls_pthread.h | 3 +++
 5 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h
index 0ff494cdec..06077a02a9 100644
--- a/include/grpc/byte_buffer.h
+++ b/include/grpc/byte_buffer.h
@@ -37,6 +37,10 @@
 #include <grpc/grpc.h>
 #include <grpc/support/slice_buffer.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum { GRPC_BB_SLICE_BUFFER } grpc_byte_buffer_type;
 
 /* byte buffers are containers for messages passed in from the public api's */
@@ -47,4 +51,8 @@ struct grpc_byte_buffer {
   } data;
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  /* GRPC_BYTE_BUFFER_H */
diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h
index cb757cf642..d3da27cf1c 100644
--- a/include/grpc/byte_buffer_reader.h
+++ b/include/grpc/byte_buffer_reader.h
@@ -37,6 +37,10 @@
 #include <grpc/grpc.h>
 #include <grpc/byte_buffer.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct grpc_byte_buffer_reader {
   grpc_byte_buffer *buffer;
   /* Different current objects correspond to different types of byte buffers */
@@ -46,4 +50,8 @@ struct grpc_byte_buffer_reader {
   } current;
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  /* GRPC_BYTE_BUFFER_READER_H */
diff --git a/include/grpc/census.h b/include/grpc/census.h
index 5f08c10032..b2049b3289 100644
--- a/include/grpc/census.h
+++ b/include/grpc/census.h
@@ -40,6 +40,10 @@
 
 #include <grpc/grpc.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Identify census functionality that can be enabled via census_initialize(). */
 enum census_functions {
   CENSUS_NONE = 0,    /* Do not enable census. */
@@ -92,4 +96,8 @@ int census_context_deserialize(const char *buffer, census_context **context);
  * future census calls will result in undefined behavior. */
 void census_context_destroy(census_context *context);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* CENSUS_CENSUS_H */
diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h
index d7ed2d8ce0..82f8f442a3 100644
--- a/include/grpc/grpc_security.h
+++ b/include/grpc/grpc_security.h
@@ -34,8 +34,8 @@
 #ifndef GRPC_GRPC_SECURITY_H
 #define GRPC_GRPC_SECURITY_H
 
-#include "grpc.h"
-#include "status.h"
+#include <grpc/grpc.h>
+#include <grpc/status.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h
index 67f169dd7d..7c42d08bfe 100644
--- a/include/grpc/support/tls_pthread.h
+++ b/include/grpc/support/tls_pthread.h
@@ -49,6 +49,9 @@ struct gpr_pthread_thread_local {
 
 #define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))
 #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key)
+#ifdef __cplusplus
+extern "C"
+#endif
 gpr_intptr gpr_tls_set(struct gpr_pthread_thread_local *tls, gpr_intptr value);
 #define gpr_tls_get(tls) ((gpr_intptr)pthread_getspecific((tls)->key))
 
-- 
GitLab