Python调用c/c++函数(1)
摘要:
Python开发效率高,运行效率低。而c/c++恰恰相反。因此在python脚本中调用c/c++的库,对python进行扩展,是很有必要的。使用python api,http://www.python.org/doc/,需要安装python-dev。test.cpp文件如下#include <python2.6/Python.h> //包含python的头文件// 1 c/cpp中的函数int my_c_function(const char *arg) { int n = system(arg); return n;}// 2 python 包装static PyObject * 阅读全文
posted @ 2012-12-20 19:16 &大飞 阅读(445) 评论(0) 推荐(0)
浙公网安备 33010602011771号