When is shared library initialization function executed?
Ali Çehreli
acehreli at yahoo.com
Thu Jul 22 07:09:31 UTC 2021
And who is responsible for it?
I had issues with shared library initialization functions being executed
only sometimes. That would result in shared library features not
registering themselves with the loading program. (It would work when D
program loaded it but not when C++ loaded the D library.)
I opened a couple of forum threads about this but luckily I worked
around the issue.
My question is related to something a colleague told me today: A shared
library's initialization function is not guaranteed to be called unless
a feature of a library is actually used. This page seems to describe the
same issue:
http://interreality.org/~reed/dylib_init.html
Although that page thinks this issue may not be relevant anymore, the
fact that my colleague had it with a recent C++ version tells me its
still current.
What do you know about this? Is this the same in D? Is this simply a
loader (linker?) issue, which would affect any language?
Thank you,
Ali
More information about the Digitalmars-d
mailing list