On Wed, Oct 24, 2007 at 01:37:06PM -0400, Richard Heck wrote:
> Andre Poenitz wrote:
> >On Wed, Oct 24, 2007 at 12:26:17PM -0400, Richard Heck wrote:
> >  
> >>Andre Poenitz wrote:
> >>    
> >>>Call a 'register' function from a constructor of a static dummy object.
> >>>This is sometimes troublesome with shared objects/older compiler,
> >>>though.
> >>> 
> >>>      
> >>Can you sketch this in pseudo code, perhaps? This is beyond my C++ 
> >>experience.
> >>    
> >
> >static struct FooInsetInitializer {
> >     FooInsetInitializer() { callSomeRegistrationFunction(); }
> >} dummy;
> >  
> 
> Thanks but sorry, this by itself doesn't mean much to me. I need 
> help---or a reference---on which all this registration business is 
> about, and how it will help me when I'm trying to call static methods of 
> a class. Is the idea that the registration function might pass pointers 
> to the static methods it wants called in various cases? If so, I think I 
> vaguely understand this. But then: When and how do the 
> InsetFooInitializer's themselves get called?

They get call on application startup. All global static objects are
initialized, for non-POD types this means calling the default
constructor.

But actually I think the code is fine as it is now.

Andre'

Reply via email to