how to compile a C/C++ function for python

纵然是瞬间 提交于 2019-12-22 16:58:23

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/9343294/how-to-compile-a-c-c-function-for-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!