How to call 'shared static this()' code of a D shared library?

Ali Çehreli acehreli at yahoo.com
Sat Jan 18 15:38:52 UTC 2020


On 1/18/20 6:14 AM, Guillaume Piolat wrote:
> On Saturday, 18 January 2020 at 03:53:43 UTC, Adam D. Ruppe wrote:
>> Did you already try rt_init? That should trigger it....
> 
> Indeed, this is done by runtime initialization.

Thank you, Adam and Guillaume. That tells me I've been using druntime 
without initializing it. :D I'm guessing the problem would be the lack 
of garbage collection? Otherwise, dynamic arrays seemed to work 
correctly (so far).

Ali

Aside: A tip for others who may need to call the Python C API from D, 
you have to call PyGILState_Ensure() and PyGILState_Release(): 
https://docs.python.org/3/c-api/init.html#non-python-created-threads


More information about the Digitalmars-d-learn mailing list