Hacker News new | past | comments | ask | show | jobs | submit login
Parseback: A pure-Lua introspection library for LuaJIT's FFI ctype objects (github.com/javierguerragiraldez)
49 points by todsacerdoti 15 days ago | hide | past | favorite | 11 comments



I’ve often felt great LuaJIT’s "just paste C declarations for FFI" was its greatest achievement. I tried to dig into the source code and port the C parser to Python, but it was beyond me at the time.

Still seems like a good idea that I hope someone will do.



Thanks!


How do you resolve the declarations for your particular system? Do you run the preprocessor?


It doesn't run the preprocessor, so you have to expose constants as externs, for example. Things like `int32_t` still work, so it must just have built in support for standard types.


It's by far the best FFI implementation in the industry across all languages. You can even setup a GCC workflow to automate the bindings by stripping information from headers.

I'm disappointed by the FFI experience everywhere else, it makes you feel like you're doing software development in the stone ages.


It's fantastic when embedding Lua in a self contained executable too! I have a routine that goes through and 'cdef's certain headers that were also #included at compile time. Super powerful extending a C program this way.


I think that's because FFI is only a small (and rather easily automatable in other means) portion of making a usable binding for the target language.


Does anyone know if there's a Lua (not LuaJIT) library for the ffi functionality? I wonder if this library could work for both


There's this https://github.com/q66/cffi-lua, I haven't used it but seems to be used a bit

Edit and Alien - https://luarocks.org/modules/mascarenhas/alien, they both use libffi - http://sourceware.org/libffi





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: