patch 9.0.2026: win32: python3 dll loading can be improved
Problem: win32: python3 dll loading can be improved
Solution: Load DLL from registry path
Support loading python3.dll and/or python3xx.dll from the path written
in the registry. To support Stable ABI's forwarder DLL (python3.dll),
use the `LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR` flag for `LoadLibraryExW()`
because python3xx.dll is placed in the same directory of python3.dll.
If Stable ABI is used, search the latest version from the registry (both
from HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE). If Stable ABI is not
used, search only the matching version.
closes: #13315
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ken Takata <kentkt@csc.jp>
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index 3d3b92a..c0b968e 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -754,8 +754,10 @@
MS-Windows ~
To use the Python interface the Python DLL must be in your search path. In a
-console window type "path" to see what directories are used. The 'pythondll'
-or 'pythonthreedll' option can be also used to specify the Python DLL.
+console window type "path" to see what directories are used. If the DLL is
+not found in your search path, Vim will check the registry to find the path
+where Python is installed. The 'pythondll' or 'pythonthreedll' option can be
+also used to specify the Python DLL.
The name of the DLL should match the Python version Vim was compiled with.
Currently the name for Python 2 is "python27.dll", that is for Python 2.7.
@@ -782,6 +784,8 @@
library with version of at least |v:python3_version| will work. See
|has-python| for how to check if Stable ABI is supported, or see if version
output includes |+python3/dyn-stable|.
+On MS-Windows, 'pythonthreedll' will be set to "python3.dll". When searching
+the DLL from the registry, Vim will search the latest version of Python.
==============================================================================
10. Python 3 *python3*