Reputation: 183
In Windows, there is a default C library msvcrt.dll.
Is it possible to write simple C programs that uses functions from msvcrt.dll only? That would relieve the need for installing the recent VC runtime.
I think a possible way is to explicitly specify /NODEFAULTLIB, and use the dll import procedure to import msvcrt.dll functions.
Anyone has a clue?
Upvotes: 5
Views: 1851
Reputation: 47954
You don't want to use msvcrt.dll.
Use the run-time library that comes with your compiler. You can link to it statically if you don't want to worry about redistributing it, or you can read about the proper ways of redistributing it with your application.
Upvotes: 3
Reputation: 76519
You can use MinGW-w64 GCC, which links to msvcrt.dll
for exactly the reason you say.
You can find downloads here. You can link your programs with -static-libgcc -static-libstdc++
if you don't want to redistribute any DLLs.
That being said, you can just simply ship the msvcr*.dll
files alongside your executable, no need to install anything.
Upvotes: 3