[issue43964] ctypes CDLL search path issue on MacOS

Victor Lazzarini report at bugs.python.org
Mon May 31 03:49:16 EDT 2021


Victor Lazzarini <Victor.Lazzarini at nuim.ie> added the comment:

Hi Ned,

thanks for your detailed response. I have to say that the LD_LIBRARY_PATH partially worked in some cases, the library got loaded. However in cases where there were dependencies, further issues appeared particularly when the  link (as revealed by otool -L) was prefixed by '@rpath'. I was able to fix these by editing these paths (which is possible in my use case), but we just need to note that it may cause difficulties for others.

We also found a solution to avoid needing to set the environment var. We use the following code

ct.CDLL(ctypes.util.find_library('mylib'))

instead of just passing the library. That works well, and perhaps you may recommend it in the docs.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43964>
_______________________________________


More information about the Python-bugs-list mailing list