From 991826317a4192cd4fb3e8505a4a7c60c0fe830c Mon Sep 17 00:00:00 2001 From: Leding Li Date: Thu, 14 Dec 2017 17:23:39 +0800 Subject: [PATCH] Add extern "C" to paddle_error_string (#6611) --- paddle/capi/error.cpp | 2 +- paddle/capi/error.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/paddle/capi/error.cpp b/paddle/capi/error.cpp index 169b65f921..96ce31b45f 100644 --- a/paddle/capi/error.cpp +++ b/paddle/capi/error.cpp @@ -14,7 +14,7 @@ limitations under the License. */ #include "error.h" -const char* paddle_error_string(paddle_error err) { +extern "C" const char* paddle_error_string(paddle_error err) { switch (err) { case kPD_NULLPTR: return "nullptr error"; diff --git a/paddle/capi/error.h b/paddle/capi/error.h index 9d9d0ed63a..2da9e0a3ef 100644 --- a/paddle/capi/error.h +++ b/paddle/capi/error.h @@ -29,9 +29,17 @@ typedef enum { kPD_UNDEFINED_ERROR = -1, } paddle_error; +#ifdef __cplusplus +extern "C" { +#endif + /** * Error string for Paddle API. */ PD_API const char* paddle_error_string(paddle_error err); +#ifdef __cplusplus +} +#endif + #endif -- GitLab