| re: Does a compiled C application have the complete standard library?
On Windows it is mildly more complex than that because you can have linker time dynamic linking, that is where you link your program with a .lib, the .lib contains code to call the .dll, the program will not start if it can not find the .dll.
Or you can have run time dynamic linking, that is where you local the library (using the API function LoadLibrary) at run time and use the function GetProcAddress to get the address of procedures with known names in the library which you can then call. The program can start without the library being present.
The fact that intelligent (and most of the well known ones are intelligent) linkers only link in the required code is a reason why (especially in a C library) it is a good idea to keep your source files as small as logically sensible. An object file normally being the smallest unit a linker and choose to link or not link.
It is also the reason that on many embedded platforms you often get 2 versions of printf, with and without floating point support. Since the floating point library for embedded platforms is often large and floating point arithmetic is often not used not having the library in makes a significant difference to program size. But if the printf without floating point support did not exist then any use of printf would automatically pull in the floating point library.
|