pyhidapi icon indicating copy to clipboard operation
pyhidapi copied to clipboard

improved dll/so load function to use PATH env variable

Open 123swk123 opened this issue 3 months ago • 1 comments

This pull request adds support for the module to search and load the HID dll/so file from the PATH environment variable.

123swk123 avatar Oct 07 '25 07:10 123swk123

The ctypes docs specifically recommend against using find_library for this purpose.

If wrapping a shared library with ctypes, it may be better to determine the shared library name at development time, and hardcode that into the wrapper module instead of using find_library() to locate the library at runtime.

It's behavior varies pretty wildly between systems, and at minimum you'd need to drop prefixes/extensions for Linux systems.

What is the actual concrete problem with reproducible steps you're trying to solve here?

cdll.LoadLibrary should already be respecting PATH

apmorton avatar Oct 08 '25 08:10 apmorton