Solved

how to include own C file in kernel source 2.4 ?

Posted on 2004-03-24
3
182 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
3 Comments
 
LVL 12

Expert Comment

by:stefan73
Comment Utility
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 50 total points
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now