[challenge] Linker surgery

Igor Stepanov wazar.leollone at yahoo.com
Fri May 17 15:47:22 PDT 2013


On Friday, 17 May 2013 at 17:57:54 UTC, Rainer Schuetze wrote:
>
>
> On 17.05.2013 14:29, Dmitry Olshansky wrote:
>> 15-May-2013 04:17, IgorStepanov пишет:
>>> Do this table linked, if you remove all functions, which use 
>>> it?
>>
>> Thanks for this try, but they DO link in always.
>> And I believe this is a key problem - each function goes into 
>> a separate
>> object but globals are always pulled in!
>>
>
> Yes, if you build a library the functions in a module are split 
> into separate object files, but data is always written into the 
> object file of the original module. The linker cannot split 
> these afterwards if any data in the module is referenced (which 
> might happen by just importing the module).
>
> A workaround could be to put the data into a different module.

What happens, if you place table into separate module? This 
module will be compiled as independent object file and (I hope) 
can be not linked if symbols from it will not be used. Or my 
logic is broken?


More information about the Digitalmars-d mailing list