动态加载共享库,这个知识点书上简单提了下,我做了个简单例子加深印象
int main(int argc, char** argv)
void* handle = dlopen ("libreciprocal .so", RTLD_LAZY);
double (*reciprocal)(int) = dlsym (handle, "reciprocal");
printf(“%d 的倒数是%g\n”,num, reciprocal(num));
extern double reciprocal (int i);
#include "reciprocal.hpp"
double reciprocal (int i) {
注:这里我将共享库放置在/home/phinecos/lib下,
本文转自Phinecos(洞庭散人)博客园博客,原文链接:http://www.cnblogs.com/phinecos/archive/2009/03/23/1419884.html,如需转载请自行联系原作者