?
Solved

how to include own C file in kernel source 2.4 ?

Posted on 2004-03-24
3
Medium Priority
?
189 Views
Last Modified: 2013-11-18
i am writing a function that is stored in another C file and want to include it in kernel file in net directory. what should i do?
Is that require me to insert a include that C file if not then Is that require me to define that function prototype in that file in which i am includeing?
the problem is that i include it in a kernel file but it gives error while compiling kernel net/network.o(.text+0x1d40a): undefined reference to `fun' where fun is the function that is written in my own C file that i include in kernel source.
0
Comment
Question by:pancoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:stefan73
ID: 10675600
Hi pancoder,
Check the include files for the net part of the kernel. There is for sure some "master include file" which is used by all .c sources. Modify this, include your own header file from there.

Cheers,

Stefan
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 200 total points
ID: 10682870
You need two things in order to add your own function to any program: A header file and an implementation file. If you duplicate the declaration of your function(s), you can get by without the header file. In your case, the problem shows up during the link phase, which means that you don't heave any problems with header files or declarations. You need to add your object file (the Makefile will know how to create the object file from your source file) to the list of files that get linked into network.o
On order to do this, add your file.o to the definition of obj-y in the Makefile in the network directory.
0
 

Expert Comment

by:namus
ID: 10694965
you need to modify the make file of the directory in which ur placing ur C code file. then include the header in that source file. then u need to compile the kernel. So that the code becomes part of the kernel code.
to compile the kernel... follow the simple steps mentioned at http://www.freeos.com/articles/2589/    (though ther r many places u can find it... its jus a reference i found out of a quick search).
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question