lua-users home
lua-l archive

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


You guessed one reason, the second is so that I can use Lua in
C++ modules that throw exceptions and use the same DLL for
mostly pure C apps.

I think I have a rather good solution (albeit I need to change a lot of code)
running with the following code.

1)  i get rid of every set guards like:
#ifdef __cplusplus
extern "C" {
#endif
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#ifdef __cplusplus
}
#endif

2) in luaconf.h alone I added

#if defined(__cplusplus)
#define LUADECLEXTERNC extern "C"
#define LUAEXTERNC "C"
#else
#define LUADECLEXTERNC
#define LUAEXTERNC
#endif

and changed

#if defined(LUA_CORE) || defined(LUA_LIB)
#define LUA_API LUADECLEXTERNC __declspec(dllexport)
#else
#define LUA_API LUADECLEXTERNC __declspec(dllimport)
#endif

#define LUAI_FUNC	extern LUAEXTERNC




On 11/3/05, Adam D. Moss <adam@gimp.org> wrote:
> David Burgess wrote:
> > I compile 2 lua modules as C++(without going into why)
>
> Is it so that Lua errors can be thrown as C++ exceptions?  Sorry to
> pry.  If you don't elucidate then the natural response is 'don't do
> that then' of course.  :)  Which isn't to say that this can't be
> fixed in a way that makes everyone happy...
>
> --Adam
>