[omniORB] maybe an omniORB designer knows

Rusty Carruth c1040@azfms.com
Thu, 24 Jun 1999 07:05:17 -0700 (MST)


> 
> 	Specifically, I want to do the following PRIOR to the entry of
> main(), 
> 
> (1) create a number of global static objects and 
> (2) then force the execution of a function that will operate on the static
> objects.

...

> 	When my program starts, the constructor for each object will check
> if it has
> been inserted into a global linked list..  After ALL of my objects have been
> created
> and inserted into the global linked list, the function should then be called
> to 
> operate on the objects.

How do you propose to know that ALL of your objects have been created?
Do you 'know ahead of time' (design time)?  What about maintainability of
this? (i.e. when you add more objects, how are you planning to be sure
your "ALL" above is still ALL)

Or perhaps that's part of your problem - how do you know when the number
of things inserted equals 'ALL of them'.

I read a trick somewhere (I think c/c++ journal) where you, during
compile time, create a thing which counts the number of objects (I think)
that you've created, and that number somehow becomes a static value
(in a way like 'static int foo=99').  Then you could use that number
to know when you've gotten to 'ALL'. 

Does anyone remember that article?  Am I dreaming it?  ;-)
And, perhaps more importantly - is that what you were looking for?


> 	
> 	One solution I was thinking about involves creating and running a
> separate thread before the entry of main().
> Is there a way to create a separate thread and have it run prior to the
> entry of main()?

What does this buy you?  You still need to know when the 'last'
constructor is being called so it can call that function you want
called.  

I suppose its too much to either over load main (does that
even make sense?) or otherwise make 'main' call your
final function?   (Yes, I realize this is probably a library or
something like that where you want as much as possible to be
automatic - but some things just work better manually ;-)/2

rc

-----
rusty@azfms.com		rustyc@inficad.com	rusty@descomp.com

(If this message is short, then its not meant to be curt,
its meant to be quick.  If its long, well, sorry about
that ;-)