[omniORB] Win32 ORB_init trouble

Duncan Grisby duncan@grisby.org
Tue Sep 3 14:58:00 2002


On Monday 26 August, Slava Garelin wrote:

> I have spotted strange ORB behavior. I have maked MFC Win32 application, and 
> have incapsulated ORB and all related properties in my interface class. 
> ORB_init happens in his constructor. The problm is : If I declare this class 
> in main application window (as member of window class) - all works fine, but 
> if I declare it like global variable, before declaring application class 
> instance variable, when no winmain() started yet - it crashes with memory 
> violation.
> Is this normal omniORB behavior ? Please explain thanks for you help.

Yes, it's normal. omniORB relies on a number of static constructors
having run before ORB_init() is called. If you call ORB_init() from a
static constructor, there's no way to guarantee that it runs after all
the other constructors, so you get crashes like the one you are
seeing.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --