On Wed, 19 Sep 2012 22:25:46 +0200, Øivind <oivind....@gmail.com> wrote:

I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother.

I have seen some threads on 'fixes' for this, e.g. adding a @standalone property to the module or similar. Has there been any progress on this?

If not would it be possible in e.g. main() to get a list of all compiled-in modules, and then iterate over them and call an init function where it exists? As long as there is a way to list the name of the modules at compile-time, this should be pretty easy..?

There's no way to get that list at compile-time, because object files may
be added at link-time. However, D has a ModuleInfo object, which contains
information on all modules in the program:

import std.stdio;
void main( ) {
    foreach( m; ModuleInfo ) {
        writeln( m.name );
    }
}

For details on how this object works, have a look-see at
src/druntime/src/object_.d in your DMD installation folder.

I'm not sure what you're asking for is possible even given this object,
but it's probably the closest you'll (easily) get.

--
Simen

Reply via email to