aboutsummaryrefslogtreecommitdiff
path: root/c-api
diff options
context:
space:
mode:
authorPhilipp Janda <siffiejoe@gmx.net>2015-09-07 17:28:28 +0200
committerPhilipp Janda <siffiejoe@gmx.net>2015-09-07 17:28:28 +0200
commit59a1fd7d73909540f090a45f18d7ea12198511b2 (patch)
tree204c2de58bcd5b494db6f6cd5f09e9edcdf338fd /c-api
parente7b17a6e784df665b7645ae6f8cfd631f49118d2 (diff)
downloadlua-compat-5.3-59a1fd7d73909540f090a45f18d7ea12198511b2.tar.gz
lua-compat-5.3-59a1fd7d73909540f090a45f18d7ea12198511b2.tar.bz2
lua-compat-5.3-59a1fd7d73909540f090a45f18d7ea12198511b2.zip
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.
Diffstat (limited to 'c-api')
-rw-r--r--c-api/compat-5.3.c2
-rw-r--r--c-api/compat-5.3.h6
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 @@
3#include <string.h> 3#include <string.h>
4#include <ctype.h> 4#include <ctype.h>
5#include <errno.h> 5#include <errno.h>
6#include <lua.h>
7#include <lauxlib.h>
8#include "compat-5.3.h" 6#include "compat-5.3.h"
9 7
10/* don't compile it again if it already is included via compat53.h */ 8/* 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 @@
4#include <stddef.h> 4#include <stddef.h>
5#include <limits.h> 5#include <limits.h>
6#include <string.h> 6#include <string.h>
7#if defined( __cplusplus ) && !defined( COMPAT53_LUA_CPP )
8extern "C" {
9#endif
7#include <lua.h> 10#include <lua.h>
8#include <lauxlib.h> 11#include <lauxlib.h>
12#if defined( __cplusplus ) && !defined( COMPAT53_LUA_CPP )
13}
14#endif
9 15
10 16
11#if defined(COMPAT53_PREFIX) 17#if defined(COMPAT53_PREFIX)