On 02/09/2017 10:38 PM, Markus Pursche wrote:
Hi, I'm trying to hot reload a DLL while the program is running to allow for rapid iteration in a game engine I am working on. I started reading up on how DLLs work between D code here: https://wiki.dlang.org/Win32_DLLs_in_D#D_code_calling_D_code_in_DLLs

I followed that example, however when I try to do the following I crash:
1. Load DLL
2. Unload DLL
3. Load DLL again

The problem I am getting is a Bad File Descriptor exception right after step 2, on my very next writeln to be exact.

Here is the exception I am getting: http://imgur.com/a/b9XBm
I spent a couple of hours trying to debug it, googling all sorts of combinations of "dlang unloadlibrary bad file descriptor", until I got the idea to try "dlang freelibrary bad file descriptor" and found this old bug report from 2004:

http://forum.dlang.org/post/cg5hpf$kpv$1...@digitaldaemon.com

This sounds absolutely spot on to the problems I am having. I tried to save stdout and reset it after unloading my library but I still crashed on the next writeln, does anyone have an idea for a workaround on this?

I'm hoping that someone like Walter or Andrei will see this and decide that it's time for this 2004 issue to finally die. :P

*sigh* 2018H1 plan I am listing shared library support.
Even better still, I will argue it as the ONLY language/druntime feature we need in it!

Seriously, this is the biggest thing holding back D atm.

Reply via email to