19-May-2013 11:02, Rainer Schuetze пишет:


On 18.05.2013 09:46, Dmitry Olshansky wrote:
18-May-2013 10:40, Rainer Schuetze пишет:


If you compile all the files on the command line for the executable
everything gets dragged in.

Then the only question would be - why we need this behavior?
It looks painfully clear to me that -lib style should be the default.

I guess it is the compilation model inherited from C++.

Facepalm. :)

Putting
everything into libraries has its own share of issues like not linking
in modules that are only accessed via the object factory or that
register with some other system in a static constructor.


I thought these are just hooked up in some fake static this constructors (and these get pulled with import alone).

Anyway - we then already have the same issues with classes from libraries that are loaded only via object factory. Meaning that it's not a new problem.


On 17.05.2013 19:57, Rainer Schuetze wrote:
 > 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).

It seems I was wrong here. Function local data is written into the same
object file as the function.

Yes, which is nice. Your advice was priceless, now I just need to re-arrange some code to put everything as local to these functions.
Since it goes to Phobos it'll be a library automatically.

--
Dmitry Olshansky

Reply via email to