X-Git-Url: https://git.llucax.com/software/druntime.git/blobdiff_plain/24f79eca36d0f4294eb276ac777b2a27dfb060dd..ee7c028ebdd89ffc05410551c6e4812187049279:/src/compiler/dmd/dmain2.d?ds=inline diff --git a/src/compiler/dmd/dmain2.d b/src/compiler/dmd/dmain2.d index 1991bd9..15c46d2 100644 --- a/src/compiler/dmd/dmain2.d +++ b/src/compiler/dmd/dmain2.d @@ -12,6 +12,7 @@ module rt.dmain2; private { + import memory; import util.console; import core.stdc.stddef; import core.stdc.stdlib; @@ -48,15 +49,13 @@ extern (C) void thread_joinAll(); */ extern (C) { - void* gc_getHandle(); - void gc_setHandle(void* p); - void gc_clrHandle(); + void* gc_getProxy(); + void gc_setProxy(void* p); + void gc_clrProxy(); alias void* function() gcGetFn; alias void function(void*) gcSetFn; alias void function() gcClrFn; - alias bool function(ExceptionHandler dg = null) rtInitFn; - alias bool function(ExceptionHandler dg = null) rtTermFn; } extern (C) void* rt_loadLibrary(in char[] name) @@ -69,12 +68,9 @@ extern (C) void* rt_loadLibrary(in char[] name) void* ptr = LoadLibraryA(temp.ptr); if (ptr is null) return ptr; - gcSetFn gcSet = cast(gcSetFn) GetProcAddress(ptr, "_gc_setHandle"); - rtInitFn rtInit = cast(rtInitFn) GetProcAddress(ptr, "_rt_init"); - if (gcSet is null || rtInit is null) - return ptr; - gcSet(gc_getHandle()); - rtInit(); + gcSetFn gcSet = cast(gcSetFn) GetProcAddress(ptr, "gc_setProxy"); + if (gcSet !is null) + gcSet(gc_getProxy()); return ptr; } @@ -84,18 +80,13 @@ extern (C) void* rt_loadLibrary(in char[] name) } } -extern (C) void rt_unloadLibrary(void* ptr) +extern (C) bool rt_unloadLibrary(void* ptr) { version (Windows) { - gcClrFn gcClr = cast(gcClrFn) GetProcAddress(ptr, "_gc_clrHandle"); - rtTermFn rtTerm = cast(rtTermFn) GetProcAddress(ptr, "_rt_term"); - - if (gcClr !is null && rtTerm !is null) - { - rtTerm(); + gcClrFn gcClr = cast(gcClrFn) GetProcAddress(ptr, "gc_clrProxy"); + if (gcClr !is null) gcClr(); - } return FreeLibrary(ptr) != 0; } else version (linux) @@ -110,7 +101,7 @@ extern (C) void rt_unloadLibrary(void* ptr) */ extern (C) void onAssertError(string file, size_t line); extern (C) void onAssertErrorMsg(string file, size_t line, string msg); -extern (C) void onArrayBoundsError(string file, size_t line); +extern (C) void onRangeError(string file, size_t line); extern (C) void onHiddenFuncError(Object o); extern (C) void onSwitchError(string file, size_t line); extern (C) bool runModuleUnitTests(); @@ -133,7 +124,7 @@ extern (C) static void _d_assert_msg(string msg, string file, uint line) extern (C) void _d_array_bounds(string file, uint line) { - onArrayBoundsError(file, line); + onRangeError(file, line); } extern (C) void _d_switch_error(string file, uint line) @@ -178,6 +169,7 @@ extern (C) bool rt_init(ExceptionHandler dg = null) try { gc_init(); + initStaticDataGC(); version (Windows) _minit(); _moduleCtor(); @@ -294,7 +286,7 @@ extern (C) int main(int argc, char **argv) bool trapExceptions = rt_trapExceptions; - void tryExec(void delegate() dg) + void tryExec(scope void delegate() dg) { if (trapExceptions) @@ -359,6 +351,7 @@ extern (C) int main(int argc, char **argv) void runAll() { gc_init(); + initStaticDataGC(); version (Windows) _minit(); _moduleCtor();