I have several libraries, each of which implement a class (derived from QObject). I would like each of these libraries to execute a function the first time they load. I found a couple of similar questions here:
Automatically executed functions when loading shared libraries
and
How exactly does __attribute__((constructor)) work?
but any initialization function I create based on the answers never executes. I've tried creating the function in a namespace, outside a namespace (and not a part of my class), using __attribute__
((constructor)), naming it _init, and specifying the function name to the linker with:
QMAKE_LFLAGS_RELEASE += -Wl,-init,libinitfunc
None of these have worked.
I should also note that I'm cross-compiling these libraries to run on an embedded ARM device that uses busybox for much of its functionality.