[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1 (beta) now available
- From: David Burgess <dburgess@...>
- Date: Wed, 2 Nov 2005 13:23:12 +1100
BTB, Sorry about the previous dud messages.
I think we have a small bug that has crept back in.
The luaconf.h now has a #include <math.h> re-introduced. It would seem
that ldo.c is
the only thing that needs this to compile. This include gives me some
grief (see below).
My solution was to remove it from luaconf and add an include for
math.h to ldo.c.
The problem:
I compile 2 lua modules as C++(without going into why), this means
that I change the
the lua includes to be wrapped in extern "C" {. This means that the math.h
definitions/declarations are compiled within the extern "C" warpper.
Because math.h and others have conditional code guarded by
#ifdef __cplusplus
This not unsuprisingly generates a lot of compilation errors.
This got me to thinking about the validity of
#ifdef __cplusplus
extern "C" {
#endif
#include "lua.h"
#include "lauxlib.h"
#ifdef __cplusplus
}
#endif
Methinks that this is only valid if lua.h and lauxlib.h have *NO*
nested system (<>)
includes. e.g. #include <math.h>
I think this varies with compiler, but the risks are high with math.h, stdarg.h,
stddefs.h, stdio.h. Each of these headers potentially have C++ specific
implementations.
David B