I need to make a program with the following requirements:
- standalone (no installation)
- optimized for size
- windows XP compatible
The problem is that for example adding #include <d3dx9.h>
and using a single function increments the executable size by 370kb.
Is there any way / tool so if I just use a couple of functions of a library, it is not entirely linked into the executable?
I tried the following with no success
- release mode
- whole program optimization
- minimize size (/O1)
- favor small code (/Os)
- /OPT:REF
- /OPT:ICF
- use link time code generation (/LTCG)
This is the test code (I'm using a version of d3dx of October 2004 that allows static linking found here https://github.com/kavika13/jumpmanzero-thirdparty)
#pragma comment (lib, "d3dx9.lib")
#include <d3dx9.h>
int main() {
D3DXCreateSphere(0, 0, 0, 0, 0, 0);
return 0;
}
Notes: It should be noted that using a lot more functionality of the same library increments the same ~370Kb.