MiniCRT

Overview

MiniCRT exists as a small, lightweight replacement for MSVCRT. It is not trying to be a complete reimplementation of MSVCRT; the goal is to allow the creation of compact and portable binaries that don't suffer from the bloat of statically linking MSVCRT or the deployment challenges of dynamically linking and distributing it.

License

This software is licensed under the terms of the MIT license.

Downloads

Latest stable source
minicrt-source.zip (version 1.0, 27.1 Kb, last updated 10 Jun 2017).
Latest development source
minicrt-source.zip (version 1.1, 35.4 Kb, last updated 5 Aug 2017).
Other versions
See the archive page.

System Requirements

MiniCRT does not depend on APIs newer than Windows NT 3.1 or Windows 95. A Unicode binary with MiniCRT can run on NT 3.1; an ANSI binary can run on Windows 95. Newer compilers will mark binaries as requiring newer versions of Windows; this is not a limitation of MiniCRT, but a limitation of the compiler.

To compile from source, you need Visual C++, version 2 or newer; or MinGW gcc; or Clang/LLVM. Visual C++ is the primary target for MiniCRT. Free versions of Visual C++ are included in the Visual C++ 2015 Build Tools, Windows SDK 7.1 (2010), or Windows SDK 7.0 (2008).

Build instructions

Visual C++

Unpack the source, open a Visual C++ command prompt, and run NMAKE. If your version of Visual C++ doesn't create a command prompt shortcut for you, you may need to run VcVars32.bat, then run NMAKE.

MinGW or Clang

Unpack the source, open a command prompt for the desired compiler, and run make.

Compilation options

Compilation options can be used by passing arguments to NMAKE or make.

DEBUG=Enable debug code. Valid values are 0 (disabled) or 1 (enabled.) Default is 0.

Supported functions

ANSI formUnicode formCompile conditional formNotes
atoiwtoittoi
exit
fclose
fgetsfgetwsftgets
fopen_wfopenftopenSupports a subset of open modes. Only "r", "rb", "w" and "wb" are supported. No text translation occurs, so "r" is equivalent to "rb" and "w" is equivalent to "wb".
fprintffwprintf_ftprintfSee printf.
free
malloc
memcmp
memcpy
memmove
memset
printfwprintf_tprintfOnly a subset of format specifiers are supported. Supports %%, %c, %d, %i, %s, %u, %x. Supports prefix for field size, leading zero (0), left align (-), Unicode string (l), ANSI string (h). Conversion from ANSI to Unicode and vice-versa assumes english characters. %d and %i treat input as unsigned.
rand
realloc
searchenv_wsearchenv_tsearchenv
searchenv_s_wsearchenv_s_tsearchenv_sWhen the buffer size is exceeded, control returns after ensuring a NULL terminated buffer; does not invoke watson or terminate the process.
searchenvex_s_wsearchenvex_s_tsearchenvex_sMiniCRT extension; does not exist in MSVCRT
_snprintf_snwprintf_sntprintfSee printf.
sprintfswprintf_stprintfSee printf.
sprintf_sswprintf_s_stprintf_sSee printf. When the buffer size is exceeded, control returns after ensuring a NULL terminated buffer; does not invoke watson or terminate the process.
strcatwcscat_tcscat
strcat_swcscat_s_tcscat_sWhen the buffer size is exceeded, control returns after ensuring a NULL terminated buffer; does not invoke watson or terminate the process.
strchrwcschr_tcschr
strcmpwcscmp_tcscmp
strcpywcscpy_tcscpy
strcspnwcscspn_tcscspn
stricmpwcsicmp_tcsicmp
strlenwcleny_tcslen
_strlwr_wcslwr_tcslwrOnly lowercases english characters.
strncatwcsncat_tcsncat
strrchrwcsrchr_tcsrchr
strspnwcsspn_tcsspn
strstrwcsstr_tcsstr
strtokwcstok_tcstok
strtok_swcstok_s_tcstok_s
_strupr_wcsupr_tcsuprOnly uppercases english characters.
srand