We use VS2012, and have a dll built with a dependency on runtime DLL (/MD). This dll is used in many different projects, and cannot be changed easily.
We also have a small launcher executable that has to able to run on freshly installed systems, hence with no runtime installed. It is linked statically against the runtime (/MT).
Now this exe depends on the above dll.
As is, the exe does not built [1]. I have observed that building it by ignoring MSVCRT (/NODEFAULTLIB:"MSVCRT.lib") solves [1], but produces [2]. Adding the few symbols reported as errors in "force symbol references" (e.g. /INCLUDE:"_strncpy") makes the build succeed.
However checking the generated exe with Dependency Walker shows the dependency to the runtime DLLs [3] through our dll. I confirmed that the strings [3] are present in it. Trying to run the exe on a clean install of Vista fails (the error says a DLL from [3] is missing). I fear that this is not possible, and I have not found any information that suggests that it is.
Can a statically linked exe provide runtime functions to a dynamically linked dll? If yes, how?
Thanks
Refs:
- 1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _sprintf already defined in libcmt.lib(sprintf.obj)
- error LNK2001: unresolved external symbol __imp__strncpy
- MSVCP110.dll, MSVCR110.dll