创建在C模块系统(动态加载) [英] Creating a module system (dynamic loading) in C
本文介绍了创建在C模块系统(动态加载)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何去加载编译的C code运行时,然后在它调用函数?并不是简单地调用exec()
How would one go about loading compiled C code at run time, and then calling functions within it? Not like simply calling exec().
编辑:该程序加载模块是在C
The the program loading the module is in C.
推荐答案
在Linux / UNIX中您可以使用POSIX 的dlopen
/ 则dlsym
/ dlerror获得
/ dlclose
函数来动态地打开共享库,并访问符号(包括函数),他们提供,请参见手册页了解详情。
In Linux/UNIX you can use the POSIX dlopen
/ dlsym
/ dlerror
/ dlclose
functions to dynamically open shared libraries and access the symbols (including functions) they provide, see the man page for details.
这篇关于创建在C模块系统(动态加载)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文