allow for switch to change Lua configuration and build with assumptions to C++ handling

This commit is contained in:
ThePhD 2017-01-02 09:36:04 -05:00
parent bacd93ad08
commit 010b6bb101
3 changed files with 23 additions and 2 deletions

View File

@ -5,6 +5,15 @@ how to handle exceptions or other errors
Here is some advice and some tricks to use when dealing with thrown exceptions, error conditions and the like in Sol.
Linker Errors
-------------
There are lots of reasons for compiler linker errors. A common one is not knowing that you've compiled the Lua library as C++: when building with C++, it is important to note that every typical (static or dynamic) library expects the C calling convention to be used and that Sol includes the code using ``extern 'C'`` where applicable.
However, when the target Lua library is compiled with C++, one must change the calling convention and name mangling scheme by getting rid of the ``extern 'C'`` block. This can be achieved by adding ``#define SOL_USING_CXX_LUA`` before including sol2, or by adding it to your compilation's command line.
Catch and CRASH!
----------------

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2016-12-26 19:02:10.449461 UTC
// This header was generated with sol v2.15.5 (revision a2691c6)
// Generated 2017-01-02 14:35:36.677712 UTC
// This header was generated with sol v2.15.5 (revision bacd93a)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP
@ -790,7 +790,13 @@ namespace sol {
// beginning of sol/compatibility/version.hpp
#ifdef SOL_USING_CXX_LUA
#include <lua.h>
#include <lualib.h>
#include <luaxlib.h>
#else
#include <lua.hpp>
#endif // C++-compiler Lua
#if defined(_WIN32) || defined(_MSC_VER)
#ifndef SOL_CODECVT_SUPPORT

View File

@ -22,7 +22,13 @@
#ifndef SOL_VERSION_HPP
#define SOL_VERSION_HPP
#ifdef SOL_USING_CXX_LUA
#include <lua.h>
#include <lualib.h>
#include <luaxlib.h>
#else
#include <lua.hpp>
#endif // C++-compiler Lua
#if defined(_WIN32) || defined(_MSC_VER)
#ifndef SOL_CODECVT_SUPPORT