What happens with the following code in a DLL ?
#include <vector>
std::vector<int> global_vector;
BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
global_vector.push_back(1);
}
return TRUE;
}
... if compiled with /MD ? The code called by the vector's constructor and push_back (ie memory management, exception handling...) lie in MSVCRT.DLL... which as far as I understand is not guaranteed to be mapped at this stage. Does it get special treatment ?