exception handling and dynamic loading

Carl Sturtivant sturtivant at gmail.com
Fri Mar 7 12:14:05 PST 2014


I am loading my own small dynamic library of functions, using 
Runtime.loadLibrary in core.runtime and want an exception thrown 
in a function in the dynamic library to be caught close to where 
I call it, which is of course in the program that's doing the 
dynamic loading. How do I get the exception mechanism to 
collaborate properly in this situation? The document
http://dlang.org/phobos/core_runtime.html#.Runtime.loadLibrary
asserts that the runtime in the dynamic library is integrated 
with that in the main program, but any exception I throw in the 
dynamic library causes a fatal crash. Exceptions thrown in my 
main program are caught properly with no problems. I'm using 
DMD32 D Compiler v2.064 on windows, and I followed the advice in
http://dlang.org/dll.html as well as having a proper winMain 
function as defined here http://wiki.dlang.org/D_for_Win32
.


More information about the Digitalmars-d-learn mailing list