When to call setAssertHandler?

Sean Kelly sean at invisibleduck.org
Wed Mar 27 12:04:36 PDT 2013


On Mar 26, 2013, at 11:37 AM, Benjamin Thaut <code at benjamin-thaut.de> wrote:

> Am 25.03.2013 23:49, schrieb Sean Kelly:
>> On Mar 22, 2013, at 2:58 AM, Benjamin Thaut <code at benjamin-thaut.de> wrote:
>> 
>>> So I want to install my own assertHandler. The problem is, that even if I call "setAssetHandler" in a shared module constructor, and that module does not import any other modules, it is still not initialized first. Is there a way to set the assert before any module constructors run without hacking druntime?
>> 
>> I'm afraid not.  I suppose this is a case I should have handled, but it didn't occur to me at the time.
> 
> Do you have some idea how to solve this in a generic way? Is this even possible without adding another feature to the language?

I'd have to give it some thought.  My first idea for solving the problem (looking for a specific named function using dlsym) should work but it seems like a hack.  The easiest fix without any library changes would be to have all the modules in your app that you want to run after the hook is set import the module that initializes the hook.


More information about the Digitalmars-d-learn mailing list