Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 27, 2011 optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either. |
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | On 27.07.2011 13:21, simendsjo wrote: > A simple hello world like dfl application takes 1.2mb. Upx does a great > job packing this to 200k, but I wonder if there is a way to make optlink > generate smaller executables? > > I couldn't find a way to get help on the numerous options in optlink, > and the help page at digitalmars doesn't list them either. Nevermind. I found the switches here: http://www.digitalmars.com/ctg/ctgLinkSwitches.html |
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | On 27.07.2011 13:26, simendsjo wrote:
> On 27.07.2011 13:21, simendsjo wrote:
>> A simple hello world like dfl application takes 1.2mb. Upx does a great
>> job packing this to 200k, but I wonder if there is a way to make optlink
>> generate smaller executables?
>>
>> I couldn't find a way to get help on the numerous options in optlink,
>> and the help page at digitalmars doesn't list them either.
>
> Nevermind. I found the switches here:
> http://www.digitalmars.com/ctg/ctgLinkSwitches.html
So what switched did you use to make it link smaller ?
|
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | On 27.07.2011 15:21, simendsjo wrote: > A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables? > > I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either. I've noticed around two times smaller exes when linked with unilink. So if you don't like packing you may try it: ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip <ftp://ftp.styx.cabel.net/pub/UniLink/> just make sure you configured it correctly (should be straightforward, there are examples) -- Dmitry Olshansky |
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | I've found it interesting how sometimes (not dfl-specific) the first compiled executable is over a meg in size, but as I add a couple of hunderd lines of code the executable size shrinks. I guess some kind of optimization takes place there.. |
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 27.07.2011 18:05, Andrej Mitrovic wrote: > I've found it interesting how sometimes (not dfl-specific) the first > compiled executable is over a meg in size, but as I add a couple of > hunderd lines of code the executable size shrinks. I guess some kind > of optimization takes place there.. LOL, it shouldn't be usually. It's possible in case if, for instance, your first version uses more different functions from lib then the second one, in effect linker could pull in less object files from library. -- Dmitry Olshansky |
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On 27.07.2011 15:45, Dmitry Olshansky wrote:
> On 27.07.2011 15:21, simendsjo wrote:
>> A simple hello world like dfl application takes 1.2mb. Upx does a
>> great job packing this to 200k, but I wonder if there is a way to make
>> optlink generate smaller executables?
>>
>> I couldn't find a way to get help on the numerous options in optlink,
>> and the help page at digitalmars doesn't list them either.
> I've noticed around two times smaller exes when linked with unilink. So
> if you don't like packing you may try it:
> ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip
> <ftp://ftp.styx.cabel.net/pub/UniLink/>
> just make sure you configured it correctly (should be straightforward,
> there are examples)
>
Thanks. Any idea if unilink works with libraries linked with optlink?
I get "Error: Invalid library file (3) 'some optlink.lib'"
|
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephan | On 27.07.2011 13:42, Stephan wrote:
> On 27.07.2011 13:26, simendsjo wrote:
>> On 27.07.2011 13:21, simendsjo wrote:
>>> A simple hello world like dfl application takes 1.2mb. Upx does a great
>>> job packing this to 200k, but I wonder if there is a way to make optlink
>>> generate smaller executables?
>>>
>>> I couldn't find a way to get help on the numerous options in optlink,
>>> and the help page at digitalmars doesn't list them either.
>>
>> Nevermind. I found the switches here:
>> http://www.digitalmars.com/ctg/ctgLinkSwitches.html
>
> So what switched did you use to make it link smaller ?
I haven't gone through the switches yet. /EXEPACK looks interesting.
|
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | == Quote from Dmitry Olshansky (dmitry.olsh@gmail.com)'s article
> On 27.07.2011 15:21, simendsjo wrote:
> > A simple hello world like dfl application takes 1.2mb. Upx does a great job packing this to 200k, but I wonder if there is a way to make optlink generate smaller executables?
> >
> > I couldn't find a way to get help on the numerous options in optlink, and the help page at digitalmars doesn't list them either.
> I've noticed around two times smaller exes when linked with unilink. So
> if you don't like packing you may try it:
> ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip
> <ftp://ftp.styx.cabel.net/pub/UniLink/>
> just make sure you configured it correctly (should be straightforward,
> there are examples)
I don't work on Windows, but I've heard optlink generates debug info and unilink doesn't, so that might be the reason?
|
July 27, 2011 Re: optlink options to reduce file size? | ||||
---|---|---|---|---|
| ||||
Posted in reply to q66 | On 27.07.2011 20:59, q66 wrote:
> == Quote from Dmitry Olshansky (dmitry.olsh@gmail.com)'s article
>> On 27.07.2011 15:21, simendsjo wrote:
>>> A simple hello world like dfl application takes 1.2mb. Upx does a
>>> great job packing this to 200k, but I wonder if there is a way to make
>>> optlink generate smaller executables?
>>>
>>> I couldn't find a way to get help on the numerous options in optlink,
>>> and the help page at digitalmars doesn't list them either.
>> I've noticed around two times smaller exes when linked with unilink. So
>> if you don't like packing you may try it:
>> ftp://ftp.styx.cabel.net/pub/UniLink/ulnb0319.zip
>> <ftp://ftp.styx.cabel.net/pub/UniLink/>
>> just make sure you configured it correctly (should be straightforward,
>> there are examples)
>
> I don't work on Windows, but I've heard optlink generates debug info and unilink
> doesn't, so that might be the reason?
Even with -O -release? I added -L/NODEBUG and -L/DEBUG, but it seems dmd overrides this with it's switches.
|
Copyright © 1999-2021 by the D Language Foundation