I could not manage to comprehand (understand) this topic -
Is c runtime just standard c library static lib added to c compiler
who then can be linked and used? or something other, if
something other what exactly it is? part of this library?
I could not manage to comprehand (understand) this topic -
Is c runtime just standard c library static lib added to c compiler
who then can be linked and used? or something other, if
something other what exactly it is? part of this library?
Normally refers to the C standard library, linked either as a static lib or a DLL.
Some C runtime stuff is automatically added, code to zero out all your uninitialised global variables being one thing that the runtime adds to your program (uninitialised statics and globals aren't included in the EXE, they just have space reserved which is cleared when the program loads, whereas initialised statics and globals do have their data section packaged with the EXE).
EDIT: Some c++ stuff is also called the c runtime, e.g. stuff to call global constructors.
Some C runtime stuff is automatically added, code to zero out all your uninitialised global variables being one thing that the runtime adds to your program (uninitialised statics and globals aren't included in the EXE, they just have space reserved which is cleared when the program loads, whereas initialised statics and globals do have their data section packaged with the EXE).
Isnt this a work for windows exe loader more than for the
program itself? I heard something about the initial functions
added (for fpu initialisations and other stuff) are this functions
logically part of the c stdlib or what? system stuff? compiler stuff?
The program does it, I think? My main experience is on consoles though. I'm pretty Windows does something similar with regards to stuff that gets called before main. You are right that the compiler adds it in, but I'd still consider it the C runtime since it is basically a static library function that is automatically included by the linker and called before main.
EDIT: The rest of the runtime is just library stuff though. C++ has more runtime for global constructor calls and exception support.
As for what it contains --- it has all the stuff in the standard library.
It contains the implementations for all the functions like printf() and fopen() and so on. All those functions from the standard library needed to be implemented by someone, the compiler vendors just pre-built them for your convenience.
Also, every compiler I'm aware of also has the source code available for their standard libraries so you can review them, edit them, or include them directly in your project, or otherwise do with them what you want. It can be interesting to read them, especially as sometimes functions are heavily optimized or written in inline assembly, while others are not.
But this 'init stuff' Is this a part of standard c library (and some standard) or this is more 'compiler side' or 'system side' eho standarizes and implements it, where it belongs to? - can i faind source to it (this init stuff0
They are functions in the library just not callable directly by your program. I wouldn't worry about it though? Unless you are writing a compiler? The init stuff is everything that happens before the call or jmp to main, the C standard mandates things which must happen before program execution reaches the main function. (e.g. uninitialised globals are zeroed, stdout, stdin and stderr streams are created for a console app, etc.).
EDIT: You can call the functions if you like though, someone posted a link to a minimal EXE program the other week which has to do all the init stuff you need manually, they are documented in the compiler docs probably. You would only do something like that if you wanted the minimum possible EXE size (or wanted to remove dependencies on the C standard library).
But this 'init stuff' Is this a part of standard c library (and some standard) or this is more 'compiler side' or 'system side' eho standarizes and implements it, where it belongs to? - can i faind source to it (this init stuff0
If you want to see them just open up the source. The code isn't a secret.
Assuming Visual C++, it is probably located under "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\crt\src" if you installed it. I believe it is included in the default install options.