Shared library loading and static constructor

tchaloupka chalucha at gmail.com
Sat Mar 23 16:56:28 UTC 2019


On Saturday, 23 March 2019 at 15:58:07 UTC, Sobaya wrote:
> What I am saying is that it can not be read when a code 
> importing (a.d) a code including the static constructor (b.d)  
> is compiled into shared library.

Hi. I've tried to add your case to the repository and at it seems 
to be working for me.
At least with dmd-2.085.0.

When run with `make dynamicd`:

```
main shared static this
+main()
utils shared static this
worker shared static this
libworker.so is loaded
entry_point1() function is found
entry_point2() function is found
...
-main()
unloading libworker.so
worker shared static ~this
utils shared static ~this
main shared static ~this
```


More information about the Digitalmars-d-learn mailing list