www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Catching exceptions from module.this()

reply mike parker <mike aldacron.com> writes:
I'm relying on static this() in some modules I'm working on to throw 
exceptions when dynamic dlls cannot be found (never been a fan of 
linking to implibs). This is fine and dandy with a WinMain, since the 
modules need to be initialized manually anyway. But what about when 
using the standard main function? In that case, the exceptions are 
caught by the runtime. Is there anyway we could get a callback 
implemented so that such exceptions can be handled in an app-specific 
way and bypass the default if desired?
May 06 2004
parent reply Mike Wynn <one_mad_alien hotmail.com> writes:
On Thu, 06 May 2004 11:29:38 +0000, mike parker <mike aldacron.com>
wrote:

I'm relying on static this() in some modules I'm working on to throw 
exceptions when dynamic dlls cannot be found (never been a fan of 
linking to implibs). This is fine and dandy with a WinMain, since the 
modules need to be initialized manually anyway. But what about when 
using the standard main function? In that case, the exceptions are 
caught by the runtime. Is there anyway we could get a callback 
implemented so that such exceptions can be handled in an app-specific 
way and bypass the default if desired?
not quite a solution (like Java there need to be a unhandledException method somewhere) but you could try looking at http://www.geocities.com/one_mad_alien/dcode/ get my util8 project look in the winex.dynloader templated module modify the SharedLibrary.getFunctionAddress method to do someother action. if you have ideas/improvements I can chat to brad as www.dsource.org and get the util8 libs put under subversion control to give you easy acess too. Mike.
May 06 2004
parent Brad Anderson <brad dsource.dot.org> writes:
Mike,

I sent you a private message thru dsource forums.  As of last night, 
your two project pages as well as Subversion repositories are all set. 
I also checked the code from your geocities site into the repositories 
as /trunk/

http://www.dsource.org/projects/



Mike Wynn wrote:
 On Thu, 06 May 2004 11:29:38 +0000, mike parker <mike aldacron.com>
 wrote:
 
 
I'm relying on static this() in some modules I'm working on to throw 
exceptions when dynamic dlls cannot be found (never been a fan of 
linking to implibs). This is fine and dandy with a WinMain, since the 
modules need to be initialized manually anyway. But what about when 
using the standard main function? In that case, the exceptions are 
caught by the runtime. Is there anyway we could get a callback 
implemented so that such exceptions can be handled in an app-specific 
way and bypass the default if desired?
not quite a solution (like Java there need to be a unhandledException method somewhere) but you could try looking at http://www.geocities.com/one_mad_alien/dcode/ get my util8 project look in the winex.dynloader templated module modify the SharedLibrary.getFunctionAddress method to do someother action. if you have ideas/improvements I can chat to brad as www.dsource.org and get the util8 libs put under subversion control to give you easy acess too. Mike.
May 06 2004