how to make D program footprint smaller ?

dangbinghoo dangbinghoo at gmail.com
Thu Jul 8 10:01:33 UTC 2021


I have tried to add

```
   "dflags": ["--link-defaultlib-shared"],
   "lflags": ["--as-needed"],
```

to dub.json, and my compiler is ldc2, with 800 loc program used 
`hibernated` and `asdf` package. it compiled to 27MB binary not 
stripped and even 4MB size after stripped. (When compiled to ARM, 
the binary is 3.6MB which is a little bit smaller, but link flags 
won't opt. this either!)

I tried the link flags above, but it seems that the stripped 
binary is in some size.

any suggestions for optimizing this?


thanks!
---
dbh


More information about the Digitalmars-d-learn mailing list