Mingw GDC, Dll's & Phobos

Venix venix1 at hotmail.com
Tue Apr 25 12:29:19 PDT 2006


Recently, I started working with D again. It didn't take me long to 
discover another bug with my phobos dll.  The issue I found is related 
to garbage collecting. What happens is that memory I've allocated got 
trashed whenever it ran.  This was because scanStaticData was part of 
the phobos dll and only looked at it's static section.  I have modified 
parts of phobos to fix this. I removed scanStaticData from the gc files 
and put it into dgccmain2.d.  This way custom dlls can call 
scanStaticData(); and register their own static data.  Based on the 
examples given by walter on how to make a dll use a single gc. I belive 
that should prevent the GC issue.

Other potential issues:
- moduleinit.o is not dynamically linked.  This is becuase dlls need to 
call _moduleCtor upon loading.  By dynamically linking it. Such function 
calls cause all other Module Contrustors to rerun.
- object.o is not dynmically linked.  I belive it should be. But doing 
so causes Access Violations when loading dlls of some complexity.  So 
far I haven't come across any serious repercussions.

Included is the script I use to make the dll and a patch to give 
gcc-3.4.5 (Mingw) dll support.  This patch does the same as the previos 
one I offered. So its unnecessary to run the previous one.

Mingw:
   Download 3.4.5 sources.  Extract gdc files. Patch.
   apply my patch. patch -p0 < gdc_dll.patch Should work.
   run ./gcc-3.4.5-build.sh

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gdc_dll.patch
Url: http://lists.puremagic.com/pipermail/d.gnu/attachments/20060425/58eeb992/attachment.diff 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gphobos_extract.sh
Url: http://lists.puremagic.com/pipermail/d.gnu/attachments/20060425/58eeb992/attachment-0001.diff 


More information about the D.gnu mailing list