Shared library: loading doesn't call shared static this

Mathias LANG pro.mathias.lang at gmail.com
Sun Dec 8 02:31:30 PST 2013


On Saturday, 7 December 2013 at 22:55:35 UTC, Ellery Newcomer 
wrote:
> On Saturday, 7 December 2013 at 20:11:15 UTC, Mathias LANG 
> wrote:
>
> afaik, druntime does not officially support the C main, D 
> shared library use case yet.
>
> If you have only 1 D shared library, you can insert calls to 
> rt_init and rt_term into shared lib constructors/dtors with 
> gcc. This has worked for me in pyd:
>
> https://bitbucket.org/ariovistus/pyd/src/32cf9709d711/examples/misc/dmd_sharedlibs/?at=default
>
> You don't want to be calling rt_init or rt_term multiple times, 
> though.

Thank you, and yazd, it did the trick.
May I ask why I don't want to call it multiple time though ?
 From the sentence "If the runtime was already successfully 
initialized this returns true.", I though this was handled in 
some way. Or do you mean, multiple time in case of multiple 
libraries ?


More information about the Digitalmars-d-learn mailing list