I know - there are a billion and a half similar questions. I tried most (even all) of them and none of them helped.
I need to call a c++ 11 function from python.
// test.cpp
#define DLL_PUBLIC extern "C" __attribute__ ((visibility ("default")))
DLL_PUBLIC int init_module(void** module, void** error);
I'm building SO as following:
# Make
gcc -std=c++11 -c -Wall -Werror -fPIC test.cpp
gcc -shared -o libtest.so test.o
Python code:
# test.py
test_lib = CDLL('./libtest.so')
Exception:
Traceback (most recent call last):
File "test.py", line 3, in <module>
test_lib = CDLL('./libtest.so', mode=1 )
File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: ./libtest.so: undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
I already tried to load clib and stdlib before loading my - doesn't help. Is there any generic way to specify that my lib needs to load all dependencies on loading? (as in windows dlls?)
Thanks, and sorry for bothering.
g++instead ofgcc.