From 59a1fd7d73909540f090a45f18d7ea12198511b2 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Mon, 7 Sep 2015 17:28:28 +0200 Subject: Fix linker problems when compiling as C++. When compiling compat-5.3.c as C++, the Lua symbols may still have C-linkage. Reference those symbols as `extern "C"` by default and add an option for normal (C++) linkage. --- c-api/compat-5.3.c | 2 -- c-api/compat-5.3.h | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c index 8385bba..34b8001 100644 --- a/c-api/compat-5.3.c +++ b/c-api/compat-5.3.c @@ -3,8 +3,6 @@ #include #include #include -#include -#include #include "compat-5.3.h" /* don't compile it again if it already is included via compat53.h */ diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index e3bbb11..3f1cacc 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h @@ -4,8 +4,14 @@ #include #include #include +#if defined( __cplusplus ) && !defined( COMPAT53_LUA_CPP ) +extern "C" { +#endif #include #include +#if defined( __cplusplus ) && !defined( COMPAT53_LUA_CPP ) +} +#endif #if defined(COMPAT53_PREFIX) -- cgit v1.2.3-55-g6feb