You can reduce drastically the size of your 64-bit code if you follow these few steps.
1 - Always use direct call to the core FLAT API whenever available.
2 - Prefer procedural code when there is no need to use a class to achieve the same thing.
3 - Use explicit linking rather than implicit.
4 - Get free of the runtime Library, using
Multi-threaded (/MT) in the code generation.
Here is an example on how to use explicit linking to
MSVCRT to achieve ultimate granularity
#define long_proc typedef long (__stdcall *zProc)
#define void_proc typedef void (__stdcall *zProc)
#define double_proc typedef double (__stdcall *zProc)
#define M_LOG2E 1.44269504088896340736
HMODULE MSVCRT() {
static HMODULE hModule;
if (hModule == 0) { hModule = LoadLibrary(L"MSVCRT"); }
return hModule;
}
double log2(IN double X) {
double l2 = 0;
HMODULE hModule = MSVCRT();
if (hModule) {
double_proc (double);
zProc hProc = (zProc) GetProcAddress(hModule, "log");
if (hProc) { l2 = hProc(X) * M_LOG2E; }
}
return l2;
}
void RandoMize(IN DWORD seed) {
HMODULE hModule = MSVCRT();
if (hModule) {
void_proc (DWORD);
zProc hProc = (zProc) GetProcAddress(hModule, "srand");
if (hProc) { hProc(seed); }
}
}
long Rand() {
long nRand = 0;
HMODULE hModule = MSVCRT();
if (hModule) {
long_proc ();
zProc hProc = (zProc) GetProcAddress(hModule, "rand");
if (hProc) { nRand = hProc(); }
}
return nRand;
}
size_t rnd(IN long nMin, IN long nMax) { // QWORD
double dblRange = nMax - nMin;
double dblMaxFactor = dblRange / RAND_MAX;
double dblRandomNumber = (double) Rand();
return (size_t) (nMin + dblMaxFactor * dblRandomNumber);
}
Rather than using the GDIPLUS class obscurification, see
there how to call directly the FLAT API.
This is the technic i have used to produce the tiny OpenGL/TCLib visual plugins DLL used with MBox64, some being only 13 Kb in size !