10 2012 档案

摘要:C调用C++函数库,一般不能直接调用,需要将C++库转换成C接口输出,方可以使用C调用,看下面的例子:aa.cxx#include "add.h"int sample::method(){ cout<<"method is called!\n";}aa.h#include <iostream>using namespace std;class sample{ public: int method();};将上面的两个文件生成动态库libaa.so放到 /usr/lib目录下,编译命令如下 sudo g++ -fpic -share 阅读全文
posted @ 2012-10-22 21:00 北海石松 阅读(1338) 评论(0) 推荐(0)