linux下模块与模块间,模块与内核间共享变量

 

Linux symbol export method:

 

[1] If we want export the symbol in a module, just use the EXPORT_SYMBOL(xxxx) in the C or H file.

 

  And compile the module by adding the compile flag -DEXPORT_SYMTAB.

 

  Then we can use the xxxx in the other module.

 

[2] If we want export some symbol in Kernel that is not in a module such as xxxx in the /arch/ppc/fec.c.

 

  Firstly, define the xxxx in the fec.c;

 

  Secondly, make a new file which contain the "extern" define the xxxx(for example, extern int xxxx);

 

  Lastly, in the ppc_ksyms.c we includes the new file, and add the EXPORT_SYMBOL(xxxx).

 

  Then we can use the xxxx.

 

posted on 2012-04-27 21:06  wps712  阅读(794)  评论(0编辑  收藏  举报

导航