Subject: One LKM calls functions exported by another LKM
To: None <tech-kern@NetBSD.org>
From: George Chen <chenlongsen@semptian.com>
List: tech-kern
Date: 03/09/2006 17:55:59
Hi guys,

I'm writing LKM (Loadable Kernel Module) and find I have to let LKM-A call
functions exported by LKM-B. But I don't know how to implement it.

The function is spucall(), declared as usual function in LKM-B. 
LKM-B: int spucall(int cmd);

it is referred to in LKM-A as below.
LKM-A: extern int spucall(int cmd);

No warnings or errors were reported when making.

I loaded LKM-A first. When I loaded LKM-B, it failed with following message

apu.o(.text+0xef): In function `apu_handle':
: undefined reference to `spucall'
apu.o(.text+0xff): In function `apu_handle':
: undefined reference to `spucall'
modload: can't prelink `apu.o' creating `apu'

No helpful messages were found in the web. Your instructions are highly
appreciated!

George Chen