Import table reductions with minicrt

18 Feb 2017

Previously, I showed that in some cases programs can be made to work with old versions of Windows by changing the header only to say that this wouldn't work with a standard CRT. The difference between the two cases is in the CRT - because sdir has available source code, it's possible to compile it against a different CRT, including minicrt.

Minicrt's design goal was to allow for deployment everywhere. It does this by supporting much less functionality than a standard CRT, thereby being much smaller, and depending on very little operating system functionality itself. There is nothing in minicrt that won't work on NT 3.1, so if a program doesn't need an extensive CRT, minicrt can be used to ensure it runs on more environments. As the previous examples showed, this is true even with newer compilers that don't claim support for older versions of Windows.

Thus far, I haven't found any real dependency that the compiler has on a version of Windows. The dependencies are all in the runtime libraries. So if you want to use a new compiler and are willing to use your own libraries, the version of Windows that your program needs is entirely up to you.

As somebody who typically writes code in C, that means there's very rarely a reason to require a modern version of Windows for anything.

But minicrt's usefulness as a tool to enable software to run on old versions of Windows is limited. Firstly, it depends on source code availability. Second, it depends on a codebase that needs the very limited CRT support it offers. This is frequently not the case for software that hasn't been designed with it in mind. The minicrt page describes the functions it supports.

When writing new software, whether to use minicrt depends on what's important for your program. Is binary size and distribution simplicity the most important thing? Or is functionality the most important thing? For most of the software on this site distribution simplicity is the most important consideration, but that's not necessarily true everywhere.

MinicrtMsvcrt (/MD)libcmt (/MT)
Minimum OS requirementNT 3.1/Windows 95XP/Vista for current releasesXP/Vista for current releases
Binary sizeSmallSmallRelatively large
Distribution requirementJust your programYour program, plus the corresponding DLLJust your program
Features supportedSubset of C (no C++)C/C++C/C++