I wrote a package in C++ using C++ initialization of global variables, and built it into a .so shared library. I imported it into Python successfully using ctypes (on Mac). But the moment I tried to run a function, it crashed, because variables were uninitialized because the initialization code had not been run. I know that C++ creates one or more functions to be the initialization sequence, but when I used nm -g on my library I couldn't see them. (I know what they look like in Windows libraries, but the format seems to be different on Mac.)
Does anybody know how to find and run the C++ initialization stuff?