问题描述
在开发C / C ++(= 2?)和共享对象/需要支持实时交换什么的例子将是有益的看具体实施的信息动态库的插件基础的框架?
When developing a C/C++ (=2?) plugin based framework with shared objects/dynamic libraries that need to support live swapping what examples would be helpful to look at for implementation details?
感谢。
注意:现场交换是这里的关键点,不需要重新启动系统是一个要求
Note: live swapping is the key point here, no need to restart the system is a requirement
推荐答案
如果您对POSIX,的dlopen()
,则dlsym()
和 dlclose()
都是你需要的。
If you are on POSIX, dlopen()
, dlsym()
and dlclose()
are all you need.
请参阅男人对dlsym
的细节和例子。
有大约加载动态库的好和插件的基础设施就是一个例子。
There is a good article about loading dynamic libraries, and plugin infrastructure is an example.
修改 OP添加Windows作为规定,使这种方法不会帮助,因为Windows是不符合POSIX标准。但也有在WinAPI的类似的功能 - 见 href=\"http://www.ibm.com/developerworks/aix/library/au-porting/index.html\">
EDIT OP added Windows as requirement so this approach won't help since Windows isn't POSIX-compliant. However there are similar functions in WinAPI - see here.
这篇关于好图案的C / C ++基于插件的系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!