Skip to content
Advertisement

Tag: shared-objects

Segmentation fault when importing a C++ shared object in Python

I have the following shared object: MyLib.cpp That I compile with: g++ -fPIC -shared -o MyLib.so MyLib.cpp I then use it with the following Python script: script.py Like this, it works perfectly, but if I uncomment the line //var = 10;, Python makes a segmentation fault (Python 3.8). This happens every time the object MyClass makes a change to one

Advertisement