Re: library in kernel space

Paul Goyette <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Sun, 23 Mar 2025, Peter Skvarka wrote:

>
>> You can only load other kernel modules from a kernel module (or the main
>> kernel).
>
> In this case
> when I have two modules where module_1 needs exported functions from 
> module_2.
> Module_2 must be loaded first (i.e. with modload from shell)
> and after it I can load module_1. (if I understand it good)
> Is needed to use something special when compiling both modules to be able to 
> recognize
> that some function is exported and to recognize that this function is present 
> in module_2 ? (linker switches or some macros, etc.)

In module_1 you simply add module_2 to the required list in the
MODULE() macro.

I think you can look at dk_subr module as an example of module_2
to export symbols for the run-time linker to resolve.


+---------------------+--------------------------+----------------------+
| Paul Goyette (.sig) | PGP Key fingerprint:     | E-mail addresses:    |
| (Retired)           | 1B11 1849 721C 56C8 F63A | [email protected]    |
| Software Developer  | 6E2E 05FD 15CE 9F2D 5102 | [email protected]  |
| & Network Engineer  |                          | [email protected] |
+---------------------+--------------------------+----------------------+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.