diff --git a/src/core/runtime.d b/src/core/runtime.d index c569d74efd1..dc9656db2fc 100644 --- a/src/core/runtime.d +++ b/src/core/runtime.d @@ -42,6 +42,7 @@ private extern (C) TraceHandler rt_getTraceHandler(); alias void delegate( Throwable ) ExceptionHandler; + extern (C) void _d_print_throwable(Throwable t); extern (C) void* thread_stackBottom(); @@ -380,12 +381,6 @@ extern (C) bool runModuleUnitTests() if( Runtime.sm_moduleUnitTester is null ) { - void printErr(in char[] buf) - { - import core.stdc.stdio : fprintf, stderr; - fprintf(stderr, "%.*s", cast(int)buf.length, buf.ptr); - } - size_t failed = 0; foreach( m; ModuleInfo ) { @@ -401,7 +396,7 @@ extern (C) bool runModuleUnitTests() } catch( Throwable e ) { - e.toString(&printErr); printErr("\n"); + _d_print_throwable(e); failed++; } } diff --git a/src/rt/dmain2.d b/src/rt/dmain2.d index 77edcd592b5..e1310cc0fbf 100644 --- a/src/rt/dmain2.d +++ b/src/rt/dmain2.d @@ -175,7 +175,7 @@ extern (C) int rt_init() catch (Throwable t) { _initCount = 0; - printThrowable(t); + _d_print_throwable(t); } _STD_critical_term(); _STD_monitor_staticdtor(); @@ -201,7 +201,7 @@ extern (C) int rt_term() } catch (Throwable t) { - printThrowable(t); + _d_print_throwable(t); } finally { @@ -398,7 +398,7 @@ extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc) } catch (Throwable t) { - printThrowable(t); + _d_print_throwable(t); result = EXIT_FAILURE; } } @@ -460,7 +460,7 @@ private void formatThrowable(Throwable t, void delegate(in char[] s) nothrow sin } } -private void printThrowable(Throwable t) +extern (C) void _d_print_throwable(Throwable t) { // On Windows, a console may not be present to print the output to. // Show a message box instead.