Halide icon indicating copy to clipboard operation
Halide copied to clipboard

Python 3.8 DLL load path is... troubled.

Open alexreinking opened this issue 5 years ago • 3 comments

As of at least Python 3.8, the DLL search no longer consults the PATH. Trying to hl.load_plugin("gradient_autoscheduler") fails because LoadLibraryW only searches in the Python root dir and system32. It doesn't even check the current directory (for any reasonable definition of current).

Not sure what the appropriate fix is here. Maybe we can use LoadLibraryExW with appropriate flags to get the search to include the PATH.

alexreinking avatar Apr 27 '20 21:04 alexreinking

On Python 3.8 there's a new add_dll_directory() API that might be able to help us work around this.

See: https://docs.python.org/3/whatsnew/3.8.html#ctypes See: https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew See: https://docs.python.org/3/library/os.html#os.add_dll_directory See: https://bugs.python.org/issue36085 See: https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

alexreinking avatar Sep 20 '20 20:09 alexreinking

Is this windows-only?

steven-johnson avatar Jul 15 '22 19:07 steven-johnson

Is this windows-only?

I believe so, yes. RPATH saves us on other systems.

alexreinking avatar Jul 15 '22 19:07 alexreinking