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

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


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

--- Comment #6 from Jacob Carlborg <doob at me.com> ---
(In reply to Steven Schveighoffer from comment #5)

> 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

No module info is generated if -lib is passed unless coverage, static
constructor , destructor or unittest calls are used. This is regardless if
classes are referenced or not.
https://github.com/jacob-carlborg/dmd/blob/204b4b3b5a2ccbc697fb4e9ae422294ee21867d2/src/glue.c#L457

I think the simplest workaround is to not use -lib but archive the object files
manually using "ar".

--


More information about the Digitalmars-d-bugs mailing list