fix the loading-dll-error under Windows with Python 3.8
This pull request fixes #24 and makes dll loading working correctly under Windows with python 3.8.
- By directly passing
winmode=0toctypes.CDLL, we achieve the correct default behavior. See the following posts for more details.
This stackoverflow post pointed out the issue. https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python/64472088#64472088
The author of the above post has reported this bug and it has been fixed for future python versions. https://github.com/python/cpython/issues/86280
- The full path of
warp.dllinstead of the file name is used (L459 incontext.py). This is now consistent with the logic under Mac (L464) and Linux (L469). Note that passing only the file name will still raise theFileNotFounderror in my environment, so this change is necessary for me. I haven't tested it on Windows with Python 3.7 or lower yet, but I'm happy to do it if you are interested in merging this pull request!
My environment
- OS: Windows 10
- Python version: 3.8.10
- MSVC Compiler Version (cl.exe version) 19.26.28806 for x64
- Warp version: 0.1.25
Note: this PR (adding winmode=0) would break the code for python versions 3.7 and lower (regardless of the OS), since in those versions, the __init__ method of ctypes.CDLL doesn't accept the argument winmode. So this PR could serve as a quick fix for people who face #24 for now.
Looks like related changes were merged in a810b842fe82d3e0aa99871ca4f75df9ba892b4e a long time ago. Thanks for the suggestions!