Page 1 of 3

Bloated EXEs (reprise)

PostPosted: Sat Jul 22, 2017 2:59 pm
by Enrico Maria Giordano
Anybody could tell me why the following sample generates an EXE of 3208192 bytes?

Code: Select all  Expand view
FUNCTION MAIN()

    RETURN NIL


The same compiled with xHarbour console (without FWH) is 842240 bytes. The difference is surprisingly high.

EMG

Re: Bloated EXEs (reprise)

PostPosted: Sat Jul 22, 2017 5:52 pm
by gkuhnert
Which libs do you have included? I think the libraries full of functionality make the .exe bigger 8)

Re: Bloated EXEs (reprise)

PostPosted: Sat Jul 22, 2017 6:02 pm
by Enrico Maria Giordano
Only the standard libs: fivehx.lib and fivehc.lib. But please note that I make no call to any of the FWH functions or classes (see my sample). 2.4 MB size bigger is too much for doing nothing, isn't it?

EMG

Re: Bloated EXEs (reprise)

PostPosted: Sat Jul 22, 2017 7:02 pm
by gkuhnert
It definitely are the fwh-libs. If I comment these file out of the samples buildx.bat, my .exe is 831kb, with these libs it is 3404kb.

The commented lines are:
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib %fwh%\lib\libmysql.lib + >> b32.bc
echo %fwh%\lib\pgsql.lib %hdir%\lib\libpq.lib + >> b32.bc

So, as long as you don't need functionality provided by these libs, you can keep them out of the compiling.

Re: Bloated EXEs (reprise)

PostPosted: Sat Jul 22, 2017 8:35 pm
by Enrico Maria Giordano
Gilbert,

you definitely missed the point. As the linker put a module in the EXE only if at least one of the symbols contained in that module is referenced, why we have 2.4 MB of modules linked to the EXE if it's only an empty program?

EMG

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 6:44 am
by Antonio Linares
Enrico,

Comparing the generated .map files we can see which modules are getting linked into the EXE

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 8:33 am
by Enrico Maria Giordano
Antonio,

thank you. I just send the map to your private email. Any thoughts?

EMG

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 3:29 pm
by Antonio Linares
Enrico,

Please don't link FWH libraries and check the EXE size that you get

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 3:42 pm
by Enrico Maria Giordano
829440 bytes

EMG

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 5:31 pm
by gkuhnert
Enrico,

sorry, I assumed the key fwh libs were a kind of a framework which always would be linked, because this these libs at least for some years now make the exe bigger. (At least from fwh1202 I can confirm with a test I made today: 839kb vs. 1772kb.
The file size with actual fivewin/xharbour is simular to yours: 831kb vs. 3404kb, which I wrote some a little further down.

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 6:25 pm
by Enrico Maria Giordano
This is something I don't understand:

- fivehx.lib specified to the linker --> EXE size: 3208192
- fivehx.lib do not specified to the linker --> EXE size: 829440

In both cases I get no linker errors! So the sample is not using any of the FWH symbols. Then why the EXE size grows when fivehx.lib is specified but not used?

EMG

Re: Bloated EXEs (reprise)

PostPosted: Sun Jul 23, 2017 8:33 pm
by Antonio Linares
Because FWH libs replace Harbour errorsys

Re: Bloated EXEs (reprise)

PostPosted: Mon Jul 24, 2017 7:36 am
by Enrico Maria Giordano
The following sample is still 3195904:

Code: Select all  Expand view
FUNCTION MAIN()

    RETURN NIL


FUNCTION ERRORSYS()

    RETURN NIL


EMG

Re: Bloated EXEs (reprise)

PostPosted: Mon Jul 24, 2017 12:10 pm
by hmpaquito
you should review fwh sources one to one searching not static function which reescribe harbour system, in order to understand that size increase.

Re: Bloated EXEs (reprise)

PostPosted: Mon Jul 24, 2017 12:36 pm
by Enrico Maria Giordano
Please note that I'm not using any Harbour functions in my sample so EXE size should not increase even if FWH redefines any of those.

EMG