digitalmars.D.learn - DLL'ing the GC
Hi guys, I was trying to extract the GC from my program into a DLL so that I could reverse my program and examine the assembly. The GC accounts for about 75kb of code, so it's rather substatial to take it out. Now I've read the D DLL's using an EXE's GC, but I was having trouble doing the reverse. At the moment, it's got a symbol undefined even though I'm exporting, but I was hoping for help beyond that debugging this. It's a little over my head. My program is quite a bit more complex, but if I can get this test case going, I can probably take it from there.
Jan 02 2008
Dan Lewis Wrote:Now I've read the "D DLL's using an EXE's GC", but I was having trouble doing the reverse.The file I mentioned is at: http://www.digitalmars.com/d/dll.html#DcodeAt the moment, it's got a symbol undefined even though I'm exporting, but I was hoping for help beyond that debugging this. It's a little over my head.I've since been working on my tokenizer while I waited for a response. I'll probably carry on with that for the rest of today in hopes someone has the patience for me. Regards, Dan
Jan 02 2008
Dan Lewis wrote:[...] I've since been working on my tokenizer while I waited for a response. I'll probably carry on with that for the rest of today in hopes someone has the patience for me.I don't think it's about patience. It's more like it's... nontrivial. =) I don't know from the top of my head. While I think it's possible to reassign the work from the EXE's GC to the DLL's at runtime, I'm not so sure about how you will create the EXE in the first place without linking it to the GC. You would have to have a kind of proxy GC-lib that provides all the necessary symbols and minimal memory management (allocation) until the GC-in-the-DLL is loaded. You then recompile you runtime lib (Phobos or Tango, btw?) with that GC-"stub". All that sounds like a long, nontrivial process, and will probably not be explained exhaustively in one posting, as you'll have to do it in order to know what exactly you have to do. =) regards, frank
Jan 03 2008
0ffh Wrote:Dan Lewis wrote:Alright guys, I've got the GC in a DLL, and apparently there's a separate file provided with DMD that provides the symbols for the GC, without bringing in the whole machine. I need to figure out how to: 1) compile Walnut without the GC in it. 2) cause Walnut to use the GC DLL. Getting this solved will let us profile programs in a disassembler without 80kb of unrelated crap staring back.[...] I've since been working on my tokenizer while I waited for a response. I'll probably carry on with that for the rest of today in hopes someone has the patience for me.I don't think it's about patience. It's more like it's... nontrivial. =) I don't know from the top of my head. While I think it's possible to reassign the work from the EXE's GC to the DLL's at runtime, I'm not so sure about how you will create the EXE in the first place without linking it to the GC. You would have to have a kind of proxy GC-lib that provides all the necessary symbols and minimal memory management (allocation) until the GC-in-the-DLL is loaded. You then recompile you runtime lib (Phobos or Tango, btw?) with that GC-"stub". All that sounds like a long, nontrivial process, and will probably not be explained exhaustively in one posting, as you'll have to do it in order to know what exactly you have to do. =) regards, frank
Jan 12 2008