Object.factory() and exe file size bloat

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 21 04:19:03 PDT 2015


On 8/21/15 6:59 AM, Johannes Pfau wrote:
> Am Thu, 20 Aug 2015 23:16:10 -0700
> schrieb Walter Bright <newshound2 at digitalmars.com>:
>
>> On 8/20/2015 11:00 PM, Mike wrote:
>>> Ideally it would be nice to only pull in those ModuleInfo instances
>>> that are actually needed in the program, and by association, only
>>> pull in those TypeInfo instances needed by the ModuleInfo.  If no
>>> ModuleInfo is used, and the associated TypeInfo is also not used,
>>> then neither is pulled in.
>>
>> I do plan to do a review of ModuleInfo with this in mind, but not
>> immediately.
>>
>
> Right now we use ModuleInfo to iterate all linked modules*. Keeping
> modules but removing the ModuleInfo seems irreconcilable with that use case?
> Of course completely removing a module could work.
>
> *:
> foreach(mod; ModuleInfo) is used in
> * druntime to run unittests for all modules
> * gdc druntime to find all modules with TLS variables for emulated TLS
>    support
> * IIRC also somehow used in dynamic shared library loading/unloading?
>

It's used to call static ctor/dtors as well.

I think for modules that have none of these features, you could omit the 
ModuleInfo.

-Steve


More information about the Digitalmars-d mailing list