import.c

来自「这些是对(用 )于 书的来源文件" Linux Device Drivers"」· C语言 代码 · 共 48 行

C
48
字号
/* * import.c -- a module using a symbol from export.c * * Tested with 2.0 on the x86, Sparc *********/#ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif/* * Use versioning if needed */#include <linux/autoconf.h> /* retrieve the CONFIG_* macros */#ifdef CONFIG_MODVERSIONS#   undef MODVERSIONS /* it might be defined */#   define MODVERSIONS#endif#ifdef MODVERSIONS#  include <linux/modversions.h>#  include "export.ver"#endif#include <linux/module.h>#include <linux/kernel.h>extern int export_function(int, int);int init_module(void){    int i = export_function(2,2);    printk("import: my mate tells that 2+2 = %i\n",i);    return 0;}void cleanup_module(void){}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?