================
@@ -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));
----------------
charles-zablit wrote:

I agree that this is a bit more expensive, I tried to benchmark it:

# Before the change

```powershell
Measure-Command { for($i=1; $i -le 50; $i++){.\bin\lldb.exe -o exit --batch }}
TotalSeconds      : 10.643811
TotalMilliseconds : 10643.811
```

# After the change

```powershell
Measure-Command { for($i=1; $i -le 50; $i++){.\bin\lldb.exe -o exit --batch }}
TotalSeconds      : 10.680583
TotalMilliseconds : 10680.583
```

That's a `0.34%` increase, I think that's reasonable considering the benefits 
we get form properly letting the user know `python.dll` is not available.

https://github.com/llvm/llvm-project/pull/168864
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to