Hey all,
Where are the bodies of all the functions declared in standard files like stdio.h, conio.h, stdlib.h etc stored. I could not trace out any OBJ or LIB files for them.
Regards,
Sriharsha.
Hey all,
Where are the bodies of all the functions declared in standard files like stdio.h, conio.h, stdlib.h etc stored. I could not trace out any OBJ or LIB files for them.
Regards,
Sriharsha.
Help everyone you can
I use the Borland 5.5 command line compiler. It has a folder named Include that has stdio.h as a 19K text file. Is that what you're asking?
Ok. OK. Let me make my doubt clear....
If you look into standard header files like stdio.h, conio.h etc, you would only find #defines and the function prototypes. But you will not find the actual body of the function (or the actual code for that function) in that file. My doubt is where do you find the code for these functions, specifically, where does the compiler look for the function code when compiling.
Regards,
Sriharsha.
Help everyone you can
This is soooooo funny haha. Anywyas you cant trace into them in a debugger without special libraries. When the standard headers were written for your compiler they are either a) linked to .lib files or b) put in to a .dll. Your compiler documentation and any good C/C++ book will tell you that these are "libraries" and some if not most are written in a combination of C/C++/ASM. When you compile and link the compiler knows which libaries to load from what you included (only the basic C or C++ runtime stuff no specifics like windows unless you have a compiler w/ specific workspace/projet settings)and stuff their bloat into your executable.
"only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein
SO, you guys mean to say that the actual code for clrscr() can be found in conio.lib..
But dear...I dont have conio.lib in the whole of my hard disk but still the function works perfectly well.
Need more clarity.
Best wishes,
Sriharsha.
Help everyone you can
>>SO, you guys mean to say that the actual code for clrscr() can be found in conio.lib..
>>But dear...I dont have conio.lib in the whole of my hard disk but still the function works perfectly well.
I don't know which platform are you on but in unix look for something like libc.a for standard C library. There are a few other such libraries too. Don't look for conio.lib etc.
Anoop.
even though you did not have conio.lib(this is error) , including conio.h should produce error
further i guess that in turbo c++ it is not necessary for a function to be defined in its own library, for example some functions may be defined in other library and the header file will refer to that library. any how functions are written in c and assembly and they are stored in binary format in the library.
further i guess, there must be an "automatic directing command" from the compiler to look for the funcion's definition in common library.
-sridhar, au,chennai,india
I have often wondered this, myself.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }