X-Git-Url: https://git.llucax.com/software/druntime.git/blobdiff_plain/0edf44cfdbe2262d5c50bfa7368ba2692600babc..3d4bc628056638dd5b264e8315b5e7b7fcf579e8:/src/gc/basic/gc.d diff --git a/src/gc/basic/gc.d b/src/gc/basic/gc.d index 4dd2d9f..a6a4611 100644 --- a/src/gc/basic/gc.d +++ b/src/gc/basic/gc.d @@ -186,3 +186,26 @@ extern (C) void gc_removeRange( void *p ) { _gc.removeRange( p ); } + +extern (C) void* gc_getHandle() +{ + return cast(void*)_gc; +} + +extern (C) void gc_setHandle(void* p) +{ + void* oldp = gc_getHandle(); + gc_t g = cast(gc_t)p; + if (g.gcversion != gcx.GCVERSION) + throw new Error("incompatible gc versions"); + + // Add our static data to the new gc + GC.scanStaticData(g); + + _gc = g; +} + +extern (C) void gc_endHandle() +{ + GC.unscanStaticData(_gc); +}