jmckaskill / luaffi

Standalone FFI library for calling C functions from lua. Compatible with the luajit FFI interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use of libffi to support platforms not supported by LuaJIT?

petercolberg opened this issue · comments

Hi,

I am wondering whether it would make sense to somehow base luaffi on libffi.

If I am not mistaken, luaffi uses the same low-level infrastructure as LuaJIT (dynasm), and therefore is limited to the same architectures as LuaJIT. The list of platforms supported by libffi is impressive, and could extend the portability of programs using the ffi to platforms that will never be supported by LuaJIT due to lack of monetary sponsorship.

Does libffi in theory provide the needed functionality for luaffi?

Regards,
Peter

Dear lua-ffi maintainer(s),

I would be very interested to get your opinion on the feasibility of using libffi. I did not look into details yet: python-cffi, which is modeled after LuaJIT's FFI, uses libffi to implement FFI in the CPython interpreter.

Peter

Possibly. There are two main chunks of platform specific code. One is the offset calculation for structs. This is not so much platform dependent as compiler dependent as it has to know how compilers handle bitfields for example. I'm not sure if libffi would help here much. The second portion is the actual function pointer calling. Here libffi might help, but I feel it would probably make an already slow library ungodly slow. Regardless it would take quite a decent chunk of work.

Hi, Luajit does not support arm linux oabi compiler, how about luaffi?