I try to load a shared libraray "R.dll" which depends on "Rblas.dll", both are in the same directory. When I load R.dll with ctypes (a python module which loads shared libraries)
import ctypes
lib = ctypes.CDLL("/path_to_r/bin/i386/R.dll")
I get an error message saying that "Rblas.dll" is not found.
What can I do ? I thought that putting both libs in the same directory is enough.
You may need to add the path that the dlls are located at to the %PATH% environmental variable. While R.DLL is loadng with an explicit path, the search for it's requested RBLAS.DLL is still searching %PATH% for it's location. Since that's a Windows level operation, there's no (easy) way to intercept and modify it from python... so changing %PATH% is required.
Though alternately, you could temporarily os.chdir to the desired directory, load the dlls, and restore the original value of os.getcwd after the dlls have loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With