lua-users home
lua-l archive

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


I guess my message didn't get in.

I've looked at luajit's lua.h and lua's lua.h, and they are almost identical, but both include luaconf.h and there the things differ.

For example LUA_JDIR is defined for luajit only.

So one way compile time to detect whether luajit is being included, instead of lua is by doing this:

#if defined(LUA_JDIR)
// luajit here
#else
// lua (or some other implementation)
#endif


On 11/30/2011 9:46 AM, Javier Guerra Giraldez wrote:
On Wed, Nov 30, 2011 at 12:32 PM, Mike Pall<mikelu-1111@mike.de>  wrote:
I don't think you understood what I said. Your code may still be
running under either Lua or LuaJIT. It only depends on which
library you link against and/or from which VM your module is
loaded. The C compiler cannot know that. You definitely want to
print the version info provided at runtime, not a static version.

Maybe Antonio's C code isn't a module, but is embedding Lua?  In that
case, i think the question makes some sense, even if the chosen
library could still be changed at dynamic link time....