Cython Wrapping A Class That Uses Another Library
I've got some C++ code dbscan.cpp and dbscan.h that work great standalone. Now I'm trying to wrap it in Cython. I'm not sure how to do this correctly, and I'm impeded by limited kn
Solution 1:
Have you tried doing what the linker ld
error is recommending? You can pass the -fPIC
flag to the compiler in the Extension objection construction in setup.py:
Extension("PyDBSCAN_lib",
# ...
extra_compile_args=['-fPIC'],
extra_link_args=['-fPIC']
# ...
)
Not sure if this should be a compiler or linker flag; I am mentioning both possibilities so that you are aware of both.
Solution 2:
You need to compile elemental using the -fPIC
compiler flag in order to use it from a shared object such as a Python extension module. Linking a normal executable to doesn't have this requirement; this is one of the requirements for code that's part a shared object.
Distutils should automatically use the -fPIC
flag on the code that it's compiling, since it knows that it's building a shared object.
Post a Comment for "Cython Wrapping A Class That Uses Another Library"