Tango built as a dynamic library

Jacob Carlborg doob at me.com
Wed Mar 17 05:56:47 PDT 2010


On 3/16/10 17:51, Eldar Insafutdinov wrote:
> Jacob Carlborg 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.
>>
>>
>> /Jacob Carlborg
>
> Thank you very much! I suppose there should not be a major problem to make it working on Linux as well?

No I don't think so. I assume the same ideas can be applied to Linux as 
well. I just don't know how to access the ModuleInfo and EH sections on 
Linux.


More information about the Digitalmars-d-announce mailing list