It was thus said that the Great 'Stefano Cossu' via lua-l once stated:
>
> I also thought about compiling all the object files into a single
> mylib.so file:
>
> gcc $(CFLAGS) -o lib/mylib.so src/*.c
>
> This way, if I set one of the C files and the `luaopen_*` function to
> the main library name, the library loads without problems and inspecting
> it with `nm` all the `luaopen_*` symbols are visible, but Lua only sees
> the members defined in the `luaopen_mylib` function.
>
> What's a recommended practice for dealing with this situation?
From the manual (Lua 5.4) about package.searchers:
The fourth searcher tries an all-in-one loader. It searches the C
path for a library for the root name of the given module. For
instance, when requiring a.b.c, it will search for a C library for
a. If found, it looks into it for an open function for the
submodule; in our example, that would be luaopen_a_b_c. With this
facility, a package can pack several C submodules into one single
library, with each submodule keeping its original open function.
That might be the way to go.
-spc