'DLL Initialization failed exe/dll libraries

I have an executable library (.EXE) to which a DLL library is linked. Both are built under /MD /RTC1 and that uses MFC in a shared DLL and the Unicode Character Set. The exe is basically a console subsystem for the unit tests and is also linked to GTest. The DLL is compiled with the following flags as well: -D_UNICODE -U_MBCS with the following preprocessor macros: _AFXDLL, WIN64, _WINDOWS, NDEBUG, _USRDLL. When I use an object from the DLL (an object to be tested from that library), and run the executable, the program crashes with the following error:

The program has exited with code -1073741502 (0xc0000142) 'DLL Initialization Failed'.

I'm running out of ideas as to why this is happening, so any help would be appreciate it. Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source