Is there a way to embed the external dll directory with setup.py?

98 views Asked by At

I am building a python extension module from source on Windows using mingw-w64. After a few modifications, the build succeeds. However, I cannot actually import the module due to

ImportError: DLL load failed while importing ...

This is because the compiled module references lapacke.dll which the compiled module does not seem to load. The dll is located in C:\msys64\mingw64\bin. Adding

import os
os.add_dll_directory(r"C:\msys64\mingw64\bin")

before the import resolves this import error. However, I cannot just add these lines whenever I want to use the module. Is there a way to tell setup.py/setuptools to add this directory automatically? I.e. hardcode into the .pyd module where the libraries are located?

0

There are 0 answers