libphobos as .so?
Gregor Richards
Richards at codu.org
Sat Jul 14 19:50:57 PDT 2007
Tom Demmer wrote:
> Hi all,
> I am trying to compile and link Phobos under Linux to a shared library.
> So far I found to problems: The minor one is a glitch in the design:
> std/gc.d and internal/gc.d go into libphobos.a with a duplicate symbol.
> This is OK because ar silently overwrites the first definition with the later on.
> For the shared lib it is sufficient just to drop the gc.o from std/gc.d from
> the link line. The fundamental problem is "throw". in internal/deh2.d the
> function _d_throw(Object) is declared extern(Windows), which gives the symbol a "@4" decoration. This means for a shared ELF lib that it is version 4.
> Is there a reason why it has to have Windows calling conventions?
> If this could be changed to Pascal and the (probably hardcoded) call to _d_throw at 4 at every "throw", building phobos as a shared lib should work.
>
> Or, is there a way to convince ld that "foo at x" is just a simple symbol?
>
> Thanks a lot,
>
> Ciao
> Tom
Irrelevant of this, DMD .so files are generally broken. If you want
reliable support for .so files, use GDC.
(Though it's a bit of a trick there too)
- Gregor Richards
More information about the Digitalmars-d
mailing list