[issue38728] Update PC/pyconfig.h to support disabling auto linking

Ben Boeckel report at bugs.python.org
Tue May 12 19:29:17 EDT 2020


Ben Boeckel <bugs.python at me.benboeckel.net> added the comment:

> Presumably you looked around for ideas before figuring out the issue

Usually when "could not find foo.lib" popping up without any mention of "foo.lib" on the link line points directly to these "autolinking" "features" being the culprit. It's just something I've learned through experience. If there's an FAQ of common problems when building C extensions, it belongs there.

While this functionality sounds nice in principle, it only really works if something also adds the directory to *look* for the library to the link line as well. But if you can get *that* to the link line, you may as well just add the ".lib" to the link line directly and not send the linker on a wild goose chase based on a header. In addition, nothing ties "find python.lib" to the one that actually goes with the header that's telling it to be found either, so you can get the wrong one too (probably not so much an issue for Python now that ABI flags are gone, but it's still a thing).

Due to these behaviors and the lack of a link directory pragma (not that you could write a relocatable one in C preprocessor anyways), I find `#pragma comment(lib)` to just be a misfeature more than anything.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38728>
_______________________________________


More information about the Python-bugs-list mailing list