如何编译Python中的C / C ++函数 [英] how to compile a C/C++ function for python

查看:101
本文介绍了如何编译Python中的C / C ++函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的,我想编译并在Python是可读的CPP源$ C ​​$ C。
蟒必须给2名作为输入,并检索一个矩阵和一个向量作为输出。
如果我不得不这样做在C / C ++我会用2个字符和2个三分球,但我不知道一个编译的C / C ++程序如何可以看出对于Python语言。

I have a source code written in cpp that I want to compile and be readable in Python. Python must give 2 filenames as input and retrieve a matrix and a vector as output. If I had to do it in C/C++ I'd use 2 chars and 2 pointers but I don't know how a compiled C/C++ program can be seen for Python language.

我希望有人能帮助我。
非常感谢你。

I hope that someone can help me. Thank you very much.

推荐答案

请尝试使用痛饮产生胶$ C需要调用Python的C / C ++ code $ C。这比写code自己更容易。

Try using Swig to generate the glue code necessary to call C/C++ code from Python. It's easier than writing the code yourself.

这篇关于如何编译Python中的C / C ++函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆