I have a dll with DllMain() function defined as below.

Code:
int DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*pReserved*/)
{
    BOOL fRet = TRUE;

    switch (dwReason)
    {
    case DLL_PROCESS_ATTACH:
        {
            ...Do some initialization...  
        }
        break;

    case DLL_PROCESS_DETACH:
        {
            ...Do some uninitialization...
        }
        break;
    }

    return fRet;
}
Let's say that we load a dll file in an exe file. If we kill the running instance of that exe file, would DLL_PROCESS_DETACH part of the DllMain function of the dll file be called properly? Or would the DllMain function be called only when FreeLibrary(...) invocation is made from the exe file on the dll?