JakobOvrum/LuaD

Allow for shared library building

Opened this issue · 4 comments

Since the compilers are now able to build shared libraries, please update your make process to allow building LuaD as a shared library.

LUAD_DFLAGS += -shared -X -Xf"lib/libluad.json" -deps="lib/libluad.deps"

(Notice: replace "-lib" by "-shared")

I, for one, would welcome this.

Yes, this would be very useful.

At the moment I'm building my library (which uses LuaD) as a shared library, and while it does work if I simply statically add all the files into the shared library itself (so there's no issue with LuaD in a shared library per se), a problem arises when it comes to packaging... What should be put into /usr/includes? The whole source? .di files? To what subdirectory? That's needed for frontends that use my library in order for them to get compiled.

Of course, I'd much rather LuaD was compiled as a shared library to begin with and I could just link against it. No code duplication and conflicts.

Perhaps I could also make a patch, but I don't know anything about dub and VisualD and how they handle it (my own project uses CMakeD and optionally a Makefile equivalent). And also that question about includes would need an answer.

Most of LuaD is templated code, which source needs to be available. Thus a shared library is of limited utility.

Not really... Imagine a situation where there are 5 programs using LuaD installed on the same system. With a static library, they would all have to include the source individually. With a shared library, the source is installed only once in /usr/includes, and all programs share it. And then with a .so file, all programs share the code in memory as well, plus updates can be deployed for every program. I don't see how source availability is a showstopper here.