I have a little bit strange problem, usually people tend to ask how to remove the reference to msvcrXX.dll from their executables, and I have an opposite problem: I need to force my executable to use msvcr100.dll. It is needed because I link an additional DLL that uses CRT to my project, and this DLL imports msvcr functions.
So I set the /MD option, and then when building in “Debug” I get a working code (msvcr100.dll is in the import table of the EXE), but when I try to compile “Release” I achieve a much bigger executable with the only imports from mylib.dll and kernel32.dll, which causes CRT to not being properly initialized and a runtime error because of this.
I have
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
in the code and, for example, ‘printf’ function is used.
Thanks in advance for the answers.
Add:
The solution I’ve found: add “#define _DLL” in the beginning of the code and add msvcrt.lib to the additional dependencies. Google says, this is what “/MD” has to do, don’t know why it doesn’t.
The solution I’ve found: add “#define _DLL” in the beginning of the code and add msvcrt.lib to the additional dependencies. Google says, this is what “/MD” has to do, don’t know why it doesn’t.
Any more beautiful ideas are still appreciated.