order of static constructor execution

Walter Bright newshound1 at digitalmars.com
Tue Mar 16 12:03:05 PDT 2010


Regan Heath wrote:
> So, this needs to work when compiling modules seperately and then 
> linking, likewise libraries, right?  Is that the problem you're 
> referring to?

Yes.

> Couldn't you store a list of dependencies in usage order in the output 
> of the compile (the .o[bj] file) and use these lists when linking to 
> resolve module init order.  You would need to know the 'main' module for 
> a starting point, but from there you should be able to create an 
> ordering.  You'd probably want to treat a static library as a single 
> dependency, likewise C libraries etc.

Then you'd have to essentially build the linker into the compiler.



More information about the Digitalmars-d mailing list