I have a C++ library repeater.so
that I can load from Python in Linux the following way:
import numpy as np
repeater = np.ctypeslib.load_library('librepeater.so', '.')
However, when I compile the same library on Mac OS X (Snow Leopard, 32 bit) and get repeater.dylib
, and then run the following in Python:
import numpy as np
repeater = np.ctypeslib.load_library('librepeater.dylib', '.')
I get the following error:
OSError: dlopen(/mydir/librepeater.dylib, 6): no suitable image found. Did find:
/mydir/librepeater.dylib: mach-o, but wrong architecture
Do I have to do something different to load a dynamic library in Python on Mac OS X?
file
did the trick: I modified the architecture in the compiler settings to match the python installation and now it works. Thanks! – Homeless