WCRT - Win32API Based C Runtime Library
Introduction
WCRT is a small C runtime library for Visual C++, which implements parts of its functionality through calls to the Win32API. It is meant as a replacement for the Visual C runtime library (libc.lib). The main purpose of this library is to allow the creation of small statically linked executables from regular C source files. As an example, consider the following simple program: #include <stdio.h> int main() { printf("Hello World!"); return 0; } Compiling with Visual C++ 7.1 using The same source file, compiled using WCRT, is only 3.072 bytes. If we apply a little further magic, and merge the data and code sections, it ends up at 2.048 bytes. Of course this reduction in size comes at a price:
It is possible to get even smaller executables by using the Win32API directly without any C runtime (by supplying your own entry function), or writing in assembler. But I think WCRT offers a nice way to retain a lot of the power of the C runtime library without bloating small programs unnecessarily. Using msvcrt.dll will also give you a small file because it shifts the code from your executable to a dynamic link library. However the startup code with the extra memory it uses still has to be executed when the dll is mapped into memory. Yes .. I admit .. it's a geek toy ;-)
Copyright © 2004 by Jørgen Ibsen. All Rights Reserved.
Products and company names mentioned may be the trademarks of their respective owners.
|