This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-01-25.12:14:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611576882.72.0.213255422964.issue43022@roundup.psfhosted.org>
In-reply-to
Content
I am writing a small application using the embedded distribution to run a script supplied by the user. The requirements are very simple, so all I need to do is set up argv and call Py_Main.

I'm trying to load the Py_Main function dynamically (for flexibility - see below) but GetProcAddress returns 0 when loading the function from python3.dll (the stable ABI). This seems to be because the symbols in python3.dll are special "fowarding" symbols, that GetProcAddress can't handle.

Is there a way to dynamically load the Python API from the stable ABI? If there isn't currently, could one be added?

To explain my requirements in a bit more detail, I don't want to statically link, because I want to put the Python distribution in a subdirectory, so that it isn't visible on PATH along with my executable, but I'd rather avoid the complexities involved in adding a dedicated SxS manifest to point the loader to the correct subdirectory for the python3.dll.

Furthermore, I want to provide a graceful fallback if the Python distribution is missing (initially, just a friendly error message, but in future maybe locating an alternative Python installation to use) and static linking won't allow that as I can't recover control if the expected Python DLL isn't present.

The reason I want to use the stable ABI is so that I can upgrade the embedded distribution without needing to rebuild the C code. I could search for python3X.dll, and just ignore the stable ABI. But that's more filesystem code than I really want to write in C... And honestly, I feel that dynamically linking is a perfect use case for the stable ABI, so it really should be supported.
History
Date User Action Args
2021-01-25 12:14:42paul.mooresetrecipients: + paul.moore, tim.golden, zach.ware, steve.dower
2021-01-25 12:14:42paul.mooresetmessageid: <1611576882.72.0.213255422964.issue43022@roundup.psfhosted.org>
2021-01-25 12:14:42paul.moorelinkissue43022 messages
2021-01-25 12:14:42paul.moorecreate