[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Using Lua when built as C++
- From: Gisle Vanem <gvanem@...>
- Date: Thu, 30 Jan 2020 15:25:08 +0100
I did an experiment to build Lua 5.3 as C++.
It worked fine, but calling any 'lua_x()' causes
link errors.
The comment in ldo.c indicates it's possible:
** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By
** default, Lua handles errors with exceptions when compiling as
** C++ code, ...
Since LUA_API is either empty or defined as
'__declspec(dllimport)', I patched luaconf.h to suite
a C++ ABI:
#if !defined(LUA_API)
/* around the original stuff.
#endif
and a '#define LUA_API extern "C++"' in an
external 'FI./config.h' file. How else should be do it?
Or is it only 'ldo.c' that could be compiled as C++?
--
--gv