Subject: Re: One LKM calls functions exported by another LKM
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 03/10/2006 13:49:52
In article <20060309100243.BD4E763B102@mail.netbsd.org>,
George Chen <george.chen@semptian.com> wrote:
>
>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!
>

I don't think you can do this with our current lkm framework. The closest
you can get is to link both lkms into one and load it as one unit.

christos