Dynamic libraries, again

Jacob Carlborg doob at me.com
Mon Mar 15 05:40:06 PDT 2010


On 3/14/10 23:36, Walter Bright wrote:
> Jacob Carlborg wrote:
>> I've been working the whole day on getting Tango to work built as a
>> dynamic library with dmd on Mac OS X. I have one problem (for now)
>> that I can't seem to solve.
>>
>> The problem is that the module constructors are not called. That is
>> because the module info array in the object module, which contains all
>> the module constructors that should be called, is (almost) empty. It
>> seems like that the compiler or the linker doesn't put the module
>> constructors that are dynamically linked into the executable. I've
>> also tried to move the _minfo_beg and _minfo_end variables, which are
>> the beginning and the end of the sections containing the module info
>> array, from the object module to a statically linked module and then
>> passed them as arguments to the _moduleCtor function but without any
>> success.
>>
>> Does anyone have any idea have to solve the above problem? Does the
>> compiler need to be modified?
>
> There will be an _minfo_beg and _minfo_end for each loaded shared
> library. These must then be combined at runtime to form an aggregate
> array of all the modules.

I've looked at the output dumpobj gives on Tango and there are no 
__minfo_beg and __minfo_end sections but the __minfodata section is there.

> I don't know how to search the shared libraries to find the
> _minfo_beg/end sections, though I've never researched it, either.

Haven't you written dumpobj? It does just that.



More information about the Digitalmars-d mailing list