[Issue 16423] ModuleInfo missing when linking to static lib with classes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 20 15:23:12 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16423

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |code at dawg.eu
         Resolution|---                         |WONTFIX

--- Comment #3 from Martin Nowak <code at dawg.eu> ---
It goes against the intention of static libraries to drag unused classes and
module into a binary, and that also goes against our permanent fight against
giant binaries.
In fact there is issue 14555 and a PR (https://github.com/dlang/dmd/pull/4638)
in the adverse direction.

If you really want to drag in all classes from a static library, one approach
is to reference all of them from a common module.
Having an explicit list of all classes kind of contradicts the purpose of
Object.factory, but I don't see how we can easily achieve both.

Another approach is to generate object files for each module and explicitly
link against all of them (the linker won't discard object files).

Dub supports this as --build-mode=singleFile IIRC.

Yet another approach is to use shared libraries instead.

--


More information about the Digitalmars-d-bugs mailing list