private
{
+ import memory;
import util.console;
import core.stdc.stddef;
import core.stdc.stdlib;
*/
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)
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;
}
}
}
-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)
try
{
gc_init();
+ initStaticDataGC();
version (Windows)
_minit();
_moduleCtor();
void runAll()
{
gc_init();
+ initStaticDataGC();
version (Windows)
_minit();
_moduleCtor();