diff --git a/driver/main.cpp b/driver/main.cpp index 1ccc7303b1..06c3c3fdf7 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -63,6 +63,11 @@ // Needs Type already declared. #include "cond.h" +// From druntime/src/core/runtime.d. +extern "C" { +int rt_init(); +} + // in traits.c void initTraitsStringTable(); @@ -908,9 +913,13 @@ static void emitJson(Modules &modules) { } int main(int argc, char **argv) { - // stack trace on signals llvm::sys::PrintStackTraceOnErrorSignal(); + // Initialize the D runtime. + // TODO: We might want to call rt_term() using an atexit handler or so to + // run module destructors, etc. + rt_init(); + exe_path::initialize(argv[0], reinterpret_cast(main)); global._init();