On Thu, 01 Sep 2016 18:42:13 +0200, Rory McGuire via Digitalmars-d wrote: > Thanks, for the GC stub, that will be great for playing with whether or > not a little dmd app crashes after gc_annihilate(true). > > Did I understand that right?
It sounds like this there's a special function `gc_annihilate` that immediately frees all memory that libdmd has allocated. It doesn't do any reference tracking or mark/sweep. libdmd disables the collector as dmdfe does. You need to keep dmd in its own DLL. Otherwise, symbols between dmd and your application will be deduplicated or something and either you get a linker error or an arbitrary implementation is selected. Another safe way of working is to use the GC as usual, but before you call into libdmd, you call GC.disable, and you wait until you've finished using the data structures it returns before calling GC.enable.