[omniORB] omniORB client segfaults depending on the order in which object files are linked

Duncan Grisby duncan at grisby.org
Thu Nov 16 10:55:44 GMT 2006


On Tuesday 31 October, Jacob Rief wrote:

> I found an interesting phenomena while I modified the code of
> omniORB example eg2.
> Depending on the order in which two object files are linked into a
> dynamic shared object, either the example works or it segfaults.
> 
> To review the code please use this link http://svn.serles.com/omni_eg2/
> and read the README for further details.

The problem is that you are calling ORB_init() and using _narrow inside
the initialiser function that is executed at library load time. The
omniORB stubs use C++ static initialisers for various things, and they
use the same mechanism to execute at library load time. Depending on the
link order, the stub initialisers may or may not have run before the
initialiser you wrote.

The safe solution is to move your initialisation code out of the init
function, and only run it after the library is completely loaded.

Cheers,

Duncan.

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



More information about the omniORB-list mailing list