如何让用不同语言编写的两个不同程序达到link?

How to make two different programs wrote in different languages to link?

我和我的朋友在同一个项目上工作,这是一个很大的项目,所以我们拆分了这个项目。到目前为止一切正常,但真正的问题是我的朋友用 C++ 编写了代码,但我用 python 编写了代码,现在我编写的一些功能将取决于他编写的功能。就像我使用 python 编写计算器的 GUI 并且加法逻辑是用 C++ 编写的。

我们怎样才能link这两个程序得到想要的输出?

这个问题有不同的可能解决方案,具体取决于您的要求的复杂程度。

如果可以为您想从 Python 端调用的 C++ 函数创建一个 C 包装器,ctypes may be an option. If the Python program needs access to a more complex C++ API, have look at swig, Boost.Python or PyBind11 (thanks to @lubgr for mentioning the latter). If the C++ code, however, is accessible through a command line program, and it is sufficient for your case to run it that way from Python, look here