[omniORB] Problem with dynamic_cast on VC6

Bartosz Zembrzuski Bartosz.Zembrzuski at softax.com.pl
Wed May 19 12:44:11 BST 2004


Hi

I'm using OmniOrb 4.0.3 (default binary distribution) on Windows 2000 
and VC6.

I got problem using dynamic_cast on CORBA::Exception.
Below is sample code (modified echo sample):

try
{
     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

     if( argc < 2 ) {
       cerr << "usage:  eg2_clt <object reference>" << endl;
       return 1;
     }

     CORBA::Object_var obj = orb->string_to_object(argv[1]);
     Echo_var echoref = Echo::_narrow(obj);
     if( CORBA::is_nil(echoref) ) {
       cerr << "Can't narrow reference to type Echo (or it was nil)." << 
endl;
       return 1;
     }
     for (CORBA::ULong count=0; count<10; count++)
       hello(echoref);

     orb->destroy();
   }
   catch(CORBA::Exception& ex)
   {
     CORBA::SystemException* sysExc = 
dynamic_cast<CORBA::SystemException*>(&ex);

	if(sysExc)
		cerr << "Caught System::Exception" << endl;
	else	
  		cerr << "Caught CORBA::Exception." << endl;
   }
}

All exceptions thrown inside "try-catch" causes "abnormal program 
termination" while executing dynamic_cast.

If I caught std::exception I got message : " Access violation - no RTTI 
data!" :(
It looks like OmniOrb was compiled without RTTI :(((

I know I can catch CORBA::SystemException instead using dynamic_cast but 
  I'd rather use dynamic_cast.

Has anybody idea what to do ???


thanks in advance.








More information about the omniORB-list mailing list