如何编译Python中的C / C ++函数 [英] how to compile a C/C++ function for python
问题描述
我写的,我想编译并在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屋!