Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

windows - What is the difference between python3.lib and python3x.lib In the Python installation libs folder?

I've been compiling a C library, and linking in the Python3 lib files for Python bindings. I've been using the python39.lib file as the link, but I was wondering what the difference is between the 'versioned' number (e.g. python3x.lib) vs the non versioned one (python3.lib).

In answer to a question, forgot to mention that this is compiling on windows using gcc.

Thanks

question from:https://stackoverflow.com/questions/65918923/what-is-the-difference-between-python3-lib-and-python3x-lib-in-the-python-instal

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

python3.lib only contains key library functions used by cpython program (or C extension for Python). python3x.lib (such as python38.lib, python39.lib) contains the full library functions. You should link to python3.lib so that your build configuration is not affected by minor Python version upgrade such as from 3.8 to 3.9.

The linking is very platform and compiler dependent. See code comment in the PC/pyconfig.h (See reference [3]).

Additional info

  1. PEP384 - Linkage
  2. Stackoverflow question on how MSVC linker looks for specific Python debug library
  3. PC/pyconfig.h

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...