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 form | Unicode form | Compile conditional form | Notes |
---|---|---|---|
atoi | wtoi | ttoi | |
exit | |||
fclose | |||
fgets | fgetws | ftgets | |
fopen | _wfopen | ftopen | Supports 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". |
fprintf | fwprintf | _ftprintf | See printf. |
free | |||
malloc | |||
memcmp | |||
memcpy | |||
memmove | |||
memset | |||
printf | wprintf | _tprintf | Only 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_s | When 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_s | MiniCRT extension; does not exist in MSVCRT |
_snprintf | _snwprintf | _sntprintf | See printf. |
sprintf | swprintf | _stprintf | See printf. |
sprintf_s | swprintf_s | _stprintf_s | See printf. When the buffer size is exceeded, control returns after ensuring a NULL terminated buffer; does not invoke watson or terminate the process. |
strcat | wcscat | _tcscat | |
strcat_s | wcscat_s | _tcscat_s | When the buffer size is exceeded, control returns after ensuring a NULL terminated buffer; does not invoke watson or terminate the process. |
strchr | wcschr | _tcschr | |
strcmp | wcscmp | _tcscmp | |
strcpy | wcscpy | _tcscpy | |
strcspn | wcscspn | _tcscspn | |
stricmp | wcsicmp | _tcsicmp | |
strlen | wcleny | _tcslen | |
_strlwr | _wcslwr | _tcslwr | Only lowercases english characters. |
strncat | wcsncat | _tcsncat | |
strrchr | wcsrchr | _tcsrchr | |
strspn | wcsspn | _tcsspn | |
strstr | wcsstr | _tcsstr | |
strtok | wcstok | _tcstok | |
strtok_s | wcstok_s | _tcstok_s | |
_strupr | _wcsupr | _tcsupr | Only uppercases english characters. |
srand |