473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How the header files work

114 100+
Hi guys
How exactly do the header files like iostream.h and stdio.h actually work?
Where is the source code for these files located?
Is it possible to read it?
Oct 14 '07 #1
6 2061
Banfa
9,065 Expert Mod 8TB
The header file just contain declarations of functions and types and constants required to call the interface they define. Typically the code for these functions exists in the C/C++ run time library which is normally automatically linked by the linker.

The library is binary, depending on your platform the source for this library may or may not be shipped with the compiler although it is shipped more and more often these days.
Oct 14 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Also, stdio.h is a C header. C++ uses cstdio.

Also, iostream.h is the pre-ANSI C++ used prior to Sept 1998. You should be using iostream.
Oct 14 '07 #3
Firecore
114 100+
The header file just contain declarations of functions and types and constants required to call the interface they define. Typically the code for these functions exists in the C/C++ run time library which is normally automatically linked by the linker.

The library is binary, depending on your platform the source for this library may or may not be shipped with the compiler although it is shipped more and more often these days.
Is it possible to create our own libraries?
Oct 15 '07 #4
oler1s
671 Expert 512MB
Sure, and in any non-trivial project, you will be using multiple third party libraries as well as making and using your own.

A library is just pre-written code than can be reused for whatever reasons. You can either ship the source code outright, or give it out as OS specific binary files, along with supporting files for compilation such as headers.
Oct 15 '07 #5
Firecore
114 100+
Sure, and in any non-trivial project, you will be using multiple third party libraries as well as making and using your own.

A library is just pre-written code than can be reused for whatever reasons. You can either ship the source code outright, or give it out as OS specific binary files, along with supporting files for compilation such as headers.
Could you show me how to do create a sample library, that does say add two numbers or something of the sort?
Oct 15 '07 #6
Could you show me how to do create a sample library, that does say add two numbers or something of the sort?
http://www.unet.univie.ac.at/aix/aixprggd/genprogc/create_shared_lib.htm


a little bit of google always helps
Oct 15 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Hattuari | last post by:
I'm learning C++ after having spent several years in the computer industry doing both system administration and engineering. I've written code in Perl, Bash, Pascal, Ada, C, Mathematica (hundreds...
16
by: matthurne | last post by:
I just started learning C++ on my own...I'm using Accelerated C++. Something it hasn't explained and I keep wondering about is how header files actually work. I suspect it doesn't get into it...
12
by: blueblueblue2005 | last post by:
Hi, here is an example I copied from Deitel C++ book. but when I compile it, always get the above compilation error, no matter how I change the include order, please help. here is the files:...
3
by: pooja | last post by:
Suppose i have created a class c1 with f1()in c1.cpp and included this c1.cpp in file1.cpp file , which is also having main() by giving the statement #include "c1.cpp". the same i can do by...
18
by: John Smith | last post by:
Hi all What does the group think of the practise of including one header file from inside another? I have some legacy code where this has been done, and it creates a dependency on a module...
18
by: Al | last post by:
I'm still trying to do this but it never worked! In a .cpp file, I write the code, and at the beginning, I write: #ifndef MYLIST_H #define MYLIST_H ....to end: #endif What's wrong with it for...
5
by: jayceechong | last post by:
If I write my own C compiler, can I just "take" existing standard header files (e.g. stdio.h, stdlib.h, etc.) from an existing C compiler and plug them in my own? I understand I have to write my...
8
by: ginnisharma1 | last post by:
Hi All, I am very new to C language and I got really big assignment in my work.I am wondering if anyone can help me.........I need to port compiler from unix to windows and compiler is written...
2
by: shruti | last post by:
hiii all I'm tryin to call a perl script from a C program in following 2 ways- 1.By callin system function. But there's some problem because the system function is not able to executeany...
3
by: weird0 | last post by:
Hi!all. As part of the course project in the university, students have been given task to develop a front-end for SMILE( an API written in C++ for network modelling). Upon extracting the setup, it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.