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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Sep 21 08:03:45 PDT 2016


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |---

--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Martin Nowak from comment #3)
> 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.

This is penny-wise and pound-foolish. First we need to solve megabyte sized
template symbol names. Then we need full shared library support. The few
kilobytes that moduleinfo adds is nothing. Trim out unused classinfo? Then we
need to remove Object.factory method.

> 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.

I referenced the class info from within the module, and called that function.
Why is the linker excluding it? This seems like a real bug.

In fact, I actually TRY your suggestion to solve the original problem and it
doesn't work. See the PR:
https://github.com/dlang/phobos/pull/4744#issuecomment-241876407

> 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.

We can't have Object.factory and then trim out all classinfo that aren't used
directly. But in this case, I AM using it directly, and it's STILL being
trimmed out.

--


More information about the Digitalmars-d-bugs mailing list