Thread overview
Runtime.unloadLibrary does not return
Nov 03, 2012
cal
Jan 03, 2014
Colden Cullen
Jan 03, 2014
cal
Jan 04, 2014
Colden Cullen
November 03, 2012
Following the D win32 dll example (http://dlang.org/dll.html), I created a d dll with a simple exported function, which i then dynamically load and call (just like the example). This works fine, however Runtime.unloadLibrary does not return. I do however get the "DLL_PROCESS_DETACH" message, so it gets at least that far.

In fact, if I have code after the Runtime.unloadLibrary call, the program crashes (without code following the call, it just hangs).

Has anyone else seen this problem? I get this with both dmd 2.060 and 2.061.


January 03, 2014
On Saturday, 3 November 2012 at 19:36:14 UTC, cal wrote:
> Following the D win32 dll example (http://dlang.org/dll.html), I created a d dll with a simple exported function, which i then dynamically load and call (just like the example). This works fine, however Runtime.unloadLibrary does not return. I do however get the "DLL_PROCESS_DETACH" message, so it gets at least that far.
>
> In fact, if I have code after the Runtime.unloadLibrary call, the program crashes (without code following the call, it just hangs).
>
> Has anyone else seen this problem? I get this with both dmd 2.060 and 2.061.

I'm using 2.064.2, and I'm having a very similar issue. For me, the program doesn't crash until after my main has finished executing. Does anyone have any idea what might be going on?
January 03, 2014
On Friday, 3 January 2014 at 19:37:04 UTC, Colden Cullen wrote:
> I'm using 2.064.2, and I'm having a very similar issue. For me, the program doesn't crash until after my main has finished executing. Does anyone have any idea what might be going on?

For me the problem was related to this:
https://d.puremagic.com/issues/show_bug.cgi?id=1550

using the workaround in there, loading and unloading DLL's on windows works OK for me now.

January 04, 2014
On Friday, 3 January 2014 at 21:58:07 UTC, cal wrote:
> On Friday, 3 January 2014 at 19:37:04 UTC, Colden Cullen wrote:
>> I'm using 2.064.2, and I'm having a very similar issue. For me, the program doesn't crash until after my main has finished executing. Does anyone have any idea what might be going on?
>
> For me the problem was related to this:
> https://d.puremagic.com/issues/show_bug.cgi?id=1550
>
> using the workaround in there, loading and unloading DLL's on windows works OK for me now.

Wow, that worked wonderfully. Thanks for pointing me in the right direction!