On 07/11/2013 05:58 AM, Chris wrote:
I have a DLL written in D I load into a Python application via ctypes
like so:

lib = CDLL("mydll")

The DLL loads and can be used no problem. However, once the DLL is
discarded of by the program, the program either doesn't react or
crashes. I still haven't worked out how to clean up the DLL correctly
before it is unloaded / detached (from Python). I guess it's the GC
and/or some C stuff I've overlooked. I have tried both approaches
described on this page: http://dlang.org/dll.html.

Maybe someone of yous once had a similar problem and found a solution.
Any hints or suggestions would be appreciated. Thanks.

hmm. pyd uses the example under 'DLLs with a C Interface' for its windows dll code and it seems pretty stable, but then it doesn't use ctypes. It doesn't look like you need to be mucking with rt_init and rt_term, so maybe the garbage collector is trying to collect something that python still has a reference to?

Also, if you can finagle a dll out of gdc I would love to hear about it. I have not used it on windows, though.

Reply via email to