-
-
Notifications
You must be signed in to change notification settings - Fork 533
Using MSVCRT.DLL with Visual Studio compiler
Visual Studio C/C++ compiler (CL), like probably any other compiler, has C runtime library (CRT) which could be linked into final executable (or DLL) statically or dynamically. Every compiler version has its own DLL with CRT, which is typically placed into Windows system directory. Visual C++ 6.0 had CRT in msvcrt.dll, every newer compiler added some numbers to DLL name.
When you're building an application, you should decide if you'll use static or dynamic CRT. Static CRT will be included into the executable, growing its size. If application has several DLL which can allocate memory and return to application, they all should use the same memory manager which is not achievable with "static CRT" model, unless DLL will use special interface functions for accessing application's memory manager.
Dynamic CRT has no problems with memory management if all components of application uses that CRT. The problem is that you should either ship DLL(s) with application setup, or add a requirement to install DLL files from Microsoft's download server.
So, why installing compiler CRT files when there's already a version of dynamic CRT library in your system? There are discussions in Web about pro's and con's of using MSVCRT.dll. In fact, Mingw compiler uses this DLL by default. Visual C++ never uses this unless you'll use some command line tweaks to compiler. Some people says: "this is a system DLL and it shouldn't be used at all". However, following this line, I can't use kernel32.dll and user32.dll, can't use Windows API?
So, let's keep it to the application developer, whether he can or can't use MSVCRT.dll in his application. I'm using it for years in UModel, with no problems at all. I know people use with with many Windows versions - probably starting with Windows XP, with 32 and 64 bit OS setups. This allows me to make application executable smaller with no adding installation requirements.
Currently msvcrt.dll is considered as a system library not linked with compiler CRT. Every modern Windows OS (at least Windows XP+, or may be even earlier) has such DLL installed. The only way to link with this dll "officially" is to use WDK (Windows Driver Kit). We're using it non-officially, borrowing LIB files for this dll from WDK and adjusting build instructions.
- Different DLL in different OS versions
- STL
Check this page, look for "MSVCRT.zip". Actually useful files in this archive are in "lib" folder.
- CL options:
-nodefaultlib:libcmt.lib -nodefaultlib:msvcprt.lib -manifest:no
-
todo
list and explain options from common.project
-
todo
void operator delete(void* ptr, size_t) -
todo
missing __imp____acrt_iob_func -
todo
__Init_thread_epoch/header/footer