Tango built as a dynamic library

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 16 06:19:10 PDT 2010


On Tue, 16 Mar 2010 06:59:19 -0400, Jacob Carlborg <doob at me.com> wrote:

> I've managed to build Tango as a dynamic library with DMD on Mac OS X. I  
> had some problems first but I managed to solve them and everything seems  
> to work now.
>
> What I had to do to build it as a dynamic library was:
>
> Resolve the undefined symbol _Dmain.
>
> Remove the globals _deh_beg and _deh_end in the deh module and  
> _minfo_beg and _minfo_end in the object module. The beg and end  
> variables are for determine the beginning and the end of special  
> sections in the binaries but they're not put into the dynamic library  
> and therefore cause linker errors (undefined symbol).
>
> Get the module infos from the loaded executable and all the loaded  
> dynamic libraries and collect them into one array (in the object module)  
> in the order they are loaded (the data from executable should be last in  
> the array).
>
> Get all the exception handler tables from the loaded executable and all  
> the loaded dynamic libraries and collect them into one array (in the deh  
> module) in the order they are loaded (the data from executable should be  
> last in the array).
>
> Now when I thing about it what happens when a dynamic library built with  
> GDC or LDC is linked with an executable built with DMD? I'm searing for  
> specific segments and sections in the binaries that at least DMD puts  
> there.
>
> The next step is to clean up the code, create a patch, add support for  
> 64bit binaries and perhaps universal binaries (if that is needed). Then  
> I'll do the same for Phobos 1 and 2.

This is awesome!  I would recommend that you should do Phobos 2 before  
Phobos 1.  Phobos 1 is pretty much dead wood IMO.  I'm not even sure a  
patch would be accepted, since this modifies the runtime.

-Steve


More information about the Digitalmars-d-announce mailing list