Can I use static constructors for registration?

Jason House jason.james.house at gmail.com
Sun Mar 25 19:13:41 PDT 2007


In C/C++, the linker will refuse to include a translation unit if 
there's no call from another translation unit that's already been 
accepted into the executable.

Can the same thing occur in D?  I know this is an obscure kind of 
problem.  Here's some code that could be affected by this kind of issue.

import myRegistrationMechanism.register

static this(){
   register(functionNotUsedAnywhereElse);
}

void functionNotUsedAnywhereElse(inout int x){
   x += 17;
}


More information about the Digitalmars-d-learn mailing list