When to call setAssertHandler?

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


Am 28.03.2013 08:15, schrieb Jacob Carlborg:
> On 2013-03-22 10:58, Benjamin Thaut 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?
>
> What is your use case? Do you want to use assert in a module
> constructor? Or is it when running unit tests. I mean, why can't use set
> it in "main". If it's for unit testing, could you setup your own unit
> test runner that calls "setAssetHandler" before running the tests?
>

It's because I'm want to use assert in a module constructor. (Well not 
directly, but functions I call in a module constructor use assert).
On Windows x64 I want to use the CrtDebugReport to display any failing 
assert and I want this to happen for all asserts and not only for 
asserts that happen after main started.

-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list