17-May-2013 21:57, Rainer Schuetze пишет:


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).

And how then I would use these tables if even importing these modules then pulls in the data?

Local import doesn't help too.

A workaround could be to put the data into a different module.

Then say I go for X files with tables and import these modules.
It still doesn't work - evidently simply referencing a module pulls in the data.

If I compile and link the following 3 modules:


module fmod;

public immutable int[] fable = [1,2,3];


module mod;

import fmod;

int foo(int i)
{
       return fable[i];
}

//driver
import mod;

immutable byte[] bable = [1, 2, 3, 4, 5];

byte boo(int ch){
    return bable[ch];
}

void main(string[] args){
    boo(0);
}

I still have this symbol in map file: _D4fmod5fableyAi
That is immutable(int[]) fmod.fable after ddemangle.

--
Dmitry Olshansky

Reply via email to