gpt4 book ai didi

linux - 在 netfilter 中编译多个文件

转载 作者:太空宇宙 更新时间:2023-11-04 11:42:36 25 4
gpt4 key购买 nike

如何在内核模块中编译多个文件(文件调用其他文件中的函数)?

最佳答案

我将你的问题解释为,你想将多个编译单元链接到一个模块中?

在内核源代码中有很多这样的例子;它的一般要点是像这样编写 Makefile

obj-$(CONFIG_FOO) += foo.o
foo-objs: bar.o

如果 CONFIG_FOO=m,这会将 foo.obar.o 链接在一起以获得 foo.ko .参见 The Linux Kernel Module Programming Guide # Modules Spanning Multiple Files以获得更详细的解释。

关于linux - 在 netfilter 中编译多个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/489978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com