LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-30-2006, 12:23 AM   #1
Nishant Desai
Member
 
Registered: Jul 2006
Posts: 100
Blog Entries: 1

Rep: Reputation: 15
What are the functions of basic header files?


Dear All,
As we can see the device driver programs or even the programs which are system specific we can see that in those programs there are certain fixed files are included like:

#include <linux/init.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/errno.h>

can anybody tell me the purpose of these files? or can anybody show me the tutorial where i can show the functions of these files, which can help me in my project to move faster.

Thanks,
Nishant
 
Old 08-30-2006, 01:38 AM   #2
infestator
LQ Newbie
 
Registered: Jul 2006
Distribution: Gentoo
Posts: 18

Rep: Reputation: 0
you can simply look at them in /usr/include/linux. generally there's a lot of commets for every function in header files.
 
Old 08-30-2006, 01:39 AM   #3
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
In any program that relies upon some extra code (that is some code which is not in the file being compiled, such as code written by those device driver gurus) the compiler needs to know about these functions. The purpose of the #include is to tell the compiler where to look for the functions.

What the #include actually refers to is the header file which is a description of what the function will look like (the name of the function, what is returned and what needs to be passed into the function - the signature). This means that the compiler can check that you are calling the function correctly.

The linker will put all of the pieces together and so it is the linker that will need to add the actual code from these external function and your functions, creating your executable program.
 
Old 08-30-2006, 01:57 AM   #4
Nishant Desai
Member
 
Registered: Jul 2006
Posts: 100

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Quote:
Originally Posted by graemef
In any program that relies upon some extra code (that is some code which is not in the file being compiled, such as code written by those device driver gurus) the compiler needs to know about these functions. The purpose of the #include is to tell the compiler where to look for the functions.

What the #include actually refers to is the header file which is a description of what the function will look like (the name of the function, what is returned and what needs to be passed into the function - the signature). This means that the compiler can check that you are calling the function correctly.

The linker will put all of the pieces together and so it is the linker that will need to add the actual code from these external function and your functions, creating your executable program.
Dear Graemef,

Thanks for the info dude, and you are right about the #include, but i want to know about the files which are included with the #include like <linux/init.h> and <linux/module.h> etc..., and as infestator, told me that there are comments available in the header about the functions available, i have to go that way if any option is not available, but that is a long way....

Thanks,
Nishant
 
Old 08-30-2006, 02:01 AM   #5
Nishant Desai
Member
 
Registered: Jul 2006
Posts: 100

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Quote:
Originally Posted by infestator
you can simply look at them in /usr/include/linux. generally there's a lot of commets for every function in header files.
Dear Infestator,

You are right that comments are available in the header file itself about the functions made in the file, but that could be the long way, that i ll visit each and every file and each function, instead i want the overview of those files, cos as i think these files are common, they wont do different works in each program where they are included?

Thanks,
Nishant
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Absolute Newbie - Help with Some Basic Functions Ingla Linux - Newbie 7 10-18-2005 02:07 AM
Including header files and source files for classes Feenix Programming 8 09-28-2005 10:53 AM
c++ functions and header files s.santhoshkumar Programming 2 04-15-2005 12:39 AM
basic directory functions ignus Linux - Newbie 2 08-13-2004 11:36 AM
c header files in linux in place of header files in windows? harun_acs Programming 1 03-17-2004 02:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration