When integrating Python how much of the version ha

2019-08-03 04:53发布

This question is about integrating Python in another program. If I link against Python, I have an import lib named python27.lib or similar (e.g. python26.lib) for earlier 2.x versions. Apparently Python 3.x has slightly changed the rules there as I find both a python3.lib and a python33.lib in the libs folder.

Looking at the members of the import libs it seems clear that there won't be compatibility between 2.6 and 2.7 for example. However, can I assume that the import lib from Python 2.7.3 can work with older Python 2.7 DLLs, e.g. 2.7.2 or 2.7.1? I won't deploy Python along with my application and instead want to offer the Python integration as an option based on an already set up Python.

Bonus question: given the name change in Python 3 and the fact that python3.dll seems to contain function export forwarders, can I assume that linking against python3.lib will work with any Python 3.x version starting with 3.0?

1条回答
劫难
2楼-- · 2019-08-03 05:06

The patch levels of Python are binary compatible, that is when you link with 2.7.3 the binary will also work with other 2.7.x releases. This won't work between releases (that is, your binary will not work with Python 2.6 or 3.3).

When you link with python3.dll you can use every python 3.x release, but you're limited in the C APIs that you can use: you can only use the stable ABI (as described here).

查看更多
登录 后发表回答