[Lldb-commits] [lldb] [windows] improve python3.dll load check (PR #168864)

Saleem Abdulrasool via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 20 10:19:02 PST 2025


================
@@ -477,18 +477,17 @@ bool AddPythonDLLToSearchPath() {
 #endif
 
 #ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
-/// Returns whether `python3x.dll` is in the DLL search path.
+/// Returns true if `python3x.dll` can be loaded.
 bool IsPythonDLLInPath() {
 #define WIDEN2(x) L##x
 #define WIDEN(x) WIDEN2(x)
-  WCHAR foundPath[MAX_PATH];
-  DWORD result =
-      SearchPathW(nullptr, WIDEN(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME), nullptr,
-                  MAX_PATH, foundPath, nullptr);
+  HMODULE h = LoadLibraryW(WIDEN(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME));
----------------
compnerd wrote:

This is a bit more expensive. This is going to do the search and load the module (performing any dynamic relocations required and then follow that with an unload.

I wonder if this is appropriate given that we use this in the start up path.

https://github.com/llvm/llvm-project/pull/168864


More information about the lldb-commits mailing list