Re: Using Lua when built as C++
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Using Lua when built as C++
- From: v <v19930312@...>
- Date: 2020年1月30日 17:32:22 +0300
On Thu, 2020年01月30日 at 15:25 +0100, Gisle Vanem wrote:
> I did an experiment to build Lua 5.3 as C++.
> It worked fine, but calling any 'lua_x()' causes
> link errors.
>
> Or is it only 'ldo.c' that could be compiled as C++?
I'm fairly sure that you need to build and link whole Lua in C++ mode,
not only some files. Are you linking statically or dynamically? With
clang/gcc and CMake all I had to do is to set language and linkage
language to C++, then Lua compiles and works with no extra tweaks as
static library.
What are exact linkage errors? You must not place Lua includes into
`extern "C"` block if you build Lua in C++ mode.
--
v <v19930312@gmail.com>