lua-users home
lua-l archive

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


> As you are already changing those modules, you can include math.h in
> them before including the lua headers :)

The problem just got worse, my day is just ending and I have spent most of
it compiling and testing apps against 5.1 beta.
The math.h problem gives about half of my C++ modules that use Lua
the same problem as lvm.c, ldo.c, lcode.c. This is a *lot* of modules.
The problem exists with MS SDK headers in both VCs.
If the include is removed from luaconf.h the worst that happens is that
you get

warning C4013: 'xxxxx' undefined; assuming extern returning int

which is a friendly reminder to add the header to the module.

The other way out of this seems to be (not exhaustively tested) :

#if defined(LUA_CORE) || defined(LUA_LIB)
#ifdef __cplusplus
#define LUA_API extern "C" __declspec(dllexport)
#else
#define LUA_API __declspec(dllexport)
#endif
#else
#ifdef __cplusplus
#define LUA_API extern "C" __declspec(dllimport)
#else
#define LUA_API __declspec(dllimport)
#endif
#endif


and


#ifdef __cplusplus
#define LUAI_FUNC extern "C"
#else
#define LUAI_FUNC	extern
#endif


The "C" addition to extern when C++ seems to work ok in the few
cases that I have tried it.


David B