[issue43022] Unable to dynamically load functions from python3.dll

Paul Moore report at bugs.python.org
Mon Jan 25 14:02:16 EST 2021


Paul Moore <p.f.moore at gmail.com> added the comment:

Thinking about what you said, "the loader waits to load it until first accessed via GetProcAddress()" did you mean by that, that the following code should work:

    h = LoadLibraryW(L"some/path/to/python3.dll")
    py_main = GetProcAddress(h, "Py_Main")

(with some/path/to/python39.dll being loaded on the second line)? Because if so, then that's what doesn't work for me.

Or are you suggesting that I do

    AddDllDirectoryW(L"some/path/to");
    h = LoadLibraryW(L"python3.dll");
    py_main = GetProcAddress(h, "Py_Main");


Because I didn't think to try that - and I'm not 100% sure how I'd have to do stuff like LOAD_LIBRARY_SEARCH_USER_DIRS and/or SetDefaultDllDirectories to make that work. I find the Microsoft docs on all of this really complex and hard to follow if you're a non-expert :-(

----------

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


More information about the Python-bugs-list mailing list