When to call setAssertHandler?

Benjamin Thaut code at benjamin-thaut.de
Thu Mar 28 10:18:24 PDT 2013


Am 27.03.2013 20:04, schrieb Sean Kelly:
> 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.
>

Well I'm not afraid of library changes, I already have a heavily 
modified version of druntime and phobos. But whenever I find a problem 
within D I strive to find a solution which works for everyone ;-)

-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list