I support the Python module, which wraps and provides DLL functionality (also supported by me). Interaction with a DLL uses ctypes.
All this works great thanks to the wonders of ctypes. However, since I'm by no means a Python expert, there are some parts of Python that I feel are not idiomatic.
In particular, I suggest managing the location of the DLL for the user of the module. The DLL is loaded during module import. I do this because I want to switch the behavior based on the capabilities of the DLL, and I need to load the DLL to request its behavior.
By default, loading a DLL depends on the DLL search path to find the DLL. I would like to be able to allow the user to specify the full path to the DLL if they want to select a specific version.
Right now I'm doing this using an environment variable, but I admit that this is a pretty grotesque way to do this. I am looking for the canonical or idiomatic Python method for an importer of a module to transfer some information to a module, which can be accessed while importing the module.
source
share