lua-users home
lua-l archive

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


Alexander Gladysh wrote:
> This looks like a silly question, and I feel that it should be
> documented somewhere, but anyway:
> 
> Can LJ2 be used with C modules, linked with Lua (on Linux / OS X platforms)?

The very first section in http://luajit.org/luajit.html says:

  Compatibility

  LuaJIT implements the full set of language features defined by
  Lua 5.1. The virtual machine (VM) is API- and ABI-compatible to
  the standard Lua interpreter and can be deployed as a drop-in
  replacement.

The 'B' in "ABI-compatible" means binary module compatibility.

> My intuition says "no". Then I feel that LJ2 should ignore LUA_CPATH
> and have its own environment variable.

Alas, your intuition is wrong. It's deliberately using the same
module paths.

> Looks like practice says "yes" — what I've tried worked. But this is
> strange. What am I missing? What are the consequences? What if modules
> are accidentally compiled as 64-bit code?

This is not specific to LuaJIT. The 32/64 bit issues are going to
hurt you with a mixed 32 bit/64 bit Lua installation, too:

lua64: error loading module 'test' from file './test.so':
	./test.so: wrong ELF class: ELFCLASS32

--Mike