lua-users home
lua-l archive

Using Lua when built as C++

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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

AltStyle によって変換されたページ (->オリジナル) /