lua-users home
lua-l archive

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

I just want to print out the version of Lua I'm using, something like this:

  #include <luajit.h>
   fprintf(stderr, "Using LuaJIT version %s for Lua %s\n",
   fprintf(stderr, "Using Lua version %s\n", LUA_RELEASE);

Of course I could add a variable myself to specify if I'm compiling
with Lua or with LuaJIT, but I'd prefer not to add that extra variable
(because, as you say, there's total compatibility between Lua and
LuaJIT headers, so setting CFLAGS and LDFLAGS should be enough in my


> Date: Wed, 30 Nov 2011 17:05:54 +0100
> From: Mike Pall <>
> Subject: Re: Detecting LuaJIT at compile time
> To: Lua mailing list <>
> Message-ID: <>
> Content-Type: text/plain; charset=us-ascii
> Antonio Vieiro wrote:
>> Is it possible to know if I'm compiling with LuaJIT at compile time?
>> (this is, is there any #define out there specifically for detecting
>> LuaJIT?).
> Any C module you build against the Lua headers runs under LuaJIT
> or vice versa (and the headers are almost the same). Even if you
> build it with one set of headers, you can still load the same
> binary module into the other VM.
> So static detection at compile time (e.g. by some artifact in the
> headers) simply doesn't do what you think it might do.
> --Mike
> ------------------------------
> _______________________________________________
> lua-l mailing list
> End of lua-l Digest, Vol 16, Issue 131
> **************************************