Consider code
EXE:
int main ()
{
printf(\"Executable Main, loading library\\n\");
#ifdef HAVE_WINDOWS
HMODULE lib = LoadLibrary
Moo constructor isn't called before DllMain, it is called from DllMain. To be precise, its called from the real DllMain, the function Windows calls first. This real DllMain calls C++ constructors and then calls your C++ DllMain. The reason for this real DllMain is exactly to initialize constructors, something which wasn't needed in C before
Linux (GCC/ELF) doesn't have this concept at all; it only has constructors. Your manual ctor and the C++ ctor for Moo are treated the same.