lua-users home
lua-l archive

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


On Mon, 19 Jul 2021 at 16:20, Hugo Musso Gualandi
<hgualandi@inf.puc-rio.br> wrote:
>
> 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[1] 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
> systems.
>

I have similar requirement for Ravi when compiling AOT.
I think though that vast majority of scenarios will be covered by
clang, gcc, and MSVC.
And typically all I need is to compile a single C source to
corresponding dynamic library.

I think it can be a simple Lua script that know the options for the
commonly used C compilers; I would suggest avoiding heavyweight
solutions that are being proposed. I am not aware of an existing
solution though.

Regards