mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Problem of undefined reference
@ 2003-01-10 12:52 sakib mondal
  2003-01-10 13:39 ` Richard B. Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: sakib mondal @ 2003-01-10 12:52 UTC (permalink / raw)
  To: linux-kernel

Hi,

Wish you all a happy new year.

I appologize in case you are getting multiple copies of this message.

I am facing the problem of "undefined reference" for my task of using 
extended functionality of linux kernel (2.4.18) as detailed below. I shall 
appreciate any suggestion to solve the problem.


I would like to incorporate new functions into linux kernel. Therefore I 
created a file f.c with function "void foo()". Source f.c uses header file 
f.h. The header file "f.h" has declaration "extern void foo(void);". I 
included f.o in the obj-y in the Makefile in the corresponding directory. I 
could build the new kernel without any error or warning.

Now, I intended to use the extended functionality of the kernel from my 
program. I wrote g.c which calls foo(); I have included header f.h in g.c. 
However when I build g, I get the error:

"g.o(.text+ox35): undefined reference to `foo`".

I am unable to understand why "foo" is not resolved as the resident kernel 
ius built with object f.o. To diagonose the problem further I did the 
follwing things which could neither solve my problem.

i) Used "EXPORT_SYMBOL(foo);" in f.c and had f.o included in export-objs in 
the Makefile.  ==> I still get the problem of undefined reference

ii) Defined library libf.a based on f.o and included the library for 
building g. ==> The kernel is agin built ok. I could see (using nm) that the 
symbol foo in defined with type T. However, when building g, I am getting 
lot of undefined references to kernel variables and routines that are used 
in foo.

I shall appreciate any suggestion or alternative for solving the problem.

TIA.

Sakib






_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-10 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-10 12:52 Problem of undefined reference sakib mondal
2003-01-10 13:39 ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®