GC vs. Manual Memory Management Real World Comparison

Rob T rob at ucora.com
Thu Oct 25 10:16:59 PDT 2012


On Thursday, 25 October 2012 at 08:50:19 UTC, Jakob Ovrum wrote:
> You are right that compiling the runtime itself (druntime and 
> Phobos) as a shared library is not yet fully realized, but that 
> doesn't stop you from compiling your own libraries and 
> applications as shared libraries even if they statically link 
> to the runtime (which is the current default behaviour).

Yes I can build my own D shared libs, both as static PIC (.a) and 
dynamically loadable (.so). however I cannot statically link my 
shared libs to druntime + phobos as-is. The only way I can do 
that, is to also compile druntime + phobos into PIC, which can be 
done as a static PIC lib.

So what you are saying is that I can statically link PIC compiled 
druntime to my own shared lib, but I cannot build druntime as a 
dynamically loadable shared lib? I can see why thatmay work, if 
each shared lib has it's own private compy of the GC. Correct?

I recall that druntime may have some ASM code that will not work 
when compiled to PIC. I think gdc removed the offending ASM code, 
but it may still be present in the dmd version, but I don't know 
for sure.

Another question is if I can link a dynamic loadable D lib to 
C/C++ code or not? Yes I can do it, and it seems to work, but I 
was told that the GC will not necessarily work. Am I 
misunderstanding this part?

--rt


More information about the Digitalmars-d-announce mailing list