Why is my DLL 6 megs instead of 4?

Trojan Sheep

Chu Bosu
Joined
Nov 18, 2005
Messages
173
EDIT: I seem to have found my issue, please disregard.

For some reason all the DLLs I've compiled are coming out as 2 megs too big and I'm not sure why. The DLLs work fine on my system and some others, but users are reporting CTDs for no explainable reason so I'm thinking this may be it. I've tried using both Visual Studio 2003 Standard edition and Codeblocks, but both ended up with the same results.
 
My DLLs are about 2 MB too large as well. If anyone could tell me which compiler / linker options to set to get the DLL to the same size as the original one, I'd be eternally grateful. :)

I'm using Codeblocks, in case that matters.
 
All my BtS mod DLLs are 6+ megs, never had any problems. Are you using BtS, Warlords, or Vanilla?
 
In codeblocks, I've used two options which reduced the dll by 2 megs. Not sure both are needed, but I set them anyway. On the project's build options, set these compiler flags: Minimize Space [/O1] and optimize for Pentium 4 or Athlon [/G7]. They seemed logical to me, and they reduced the dll size. I don't understand most of the other flags, though.
 
Following the advice in another thread, I removed the linker option /debug, and added the following: /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF.

I also set the compiler options /GA and /G7.

This resulted in a dll which is slightly smaller than the official one. I also get a warning about kernel stuff but apparently (accrding to several other posts) there's no problem with that.

I wouldn't recommend using /O1 - it does reduce the dll size, but (if I understood it correctly despite my noobishness in this area) sacrifices execution speed for it, which is probably undesirable for a game like Civ, so /O2 ought to be the better option. I don't know whether the effects are actually noticable though.
 
Back
Top Bottom