D shared libraries

Sean Kelly sean at invisibleduck.org
Sat Apr 12 08:29:06 PDT 2008


Assuming you just want to create a shared library of your own, initialization of
the runtime is an issue.  I believe there's a doc page somewhere that describes
how to do this for Phobos, and Tango has rt_init() ad rt_term() routines for this
purpose.  If the issue is putting just Phobos into a shared lib, changes would
have to be made for how the GC is exposed, and on Windows most things
would need to be exported as well.  This is a pretty big and nasty job (for
Win32 anyway).

== Quote from Unknown W. Brackets (unknown at simplemachines.org)'s article
> Shared libraries are quite popular.  To be honest, I'm no expert with
> them or I would try my hand (I actually did a bit, but I really don't
> have much experience with linking problems.)
> Would you have any suggestions on what one might do to better understand
> the problems Phobos currently has with supporting shared libraries?  If
> I understood the problems, I would be happy to work on a solution.
> Also, since it's a bit related - what is your opinion on the concept of ddl?
> It (the concept; ddl doesn't work at all for me no matter what I try,
> and seems overcomplicated in ways) seems like a perfect way to bridge
> yet another gap between D and other popular dynamic languages like Ruby,
> Python, Perl, PHP, etc.: ease of importing/using shared code dynamically.
> -[Unknown]
> Walter Bright wrote:
> > BB wrote:
> >> Tried this on D.gnu but didn't get an answer.  Any feedback here?
> >
> > Shared libraries are also supported by the dmd compiler (the -fPIC
> > switch is implemented), but not by phobos, simply because nobody has
> > gotten around to doing it.





More information about the Digitalmars-d mailing list