[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Cross-platform way to compile a Lua module written in C
- From: Hugo Musso Gualandi <hgualandi@...>
- Date: Mon, 19 Jul 2021 12:19:56 -0300
Does anyone know if there is some tool that I can use to compile a ".c"
Lua module to a dynamic library (".so" or ".dll), with all the
appropriate compilation flags for the operating system?
My motivation is that I would like to make the Pallene compiler more
portable. Pallene uses C as a compilation target and then compiles
those C modules into dynamic libraries that can be "required" from Lua.
Currently we have some Linux-specific code for invoking the C compiler
to build the final ".so". I would love to replace it with an external
tool that also knows how to build shared libraries on other operating
I know that Luarocks knows how to compile C extension modules for Lua,
adding the appropriate compilation flags depending on the operating
system and on where the Lua header files are found. However, is there a
way to use this functionality without creating a rockspec? I only want
to compile the ".c" to an ".so". I don't want to at the same time
install the ".so" as a Luarocks package.