[omniORB] Win32 CORBA
Marek Cichy
m_are_k at o2.pl
Thu Mar 26 21:51:13 GMT 2009
Hi all
I finally created a CORBA server which works properly as a Windows
console application (using VS 9.0). I have to create another one, but as
a Win32 application. So, I just copied the code from one to another, and
something works. My question are:
Where do I have tu put ORB's initialization sequence in order to not to
lose control over application window after call orb->run()?
Is it possible to initialize orb without command line parameters?
ORB_init()?
Below is a std code created by VS and ORB initialization injected inside.
Thanks in advance for any help
Marek Cichy
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
int argc;
char* argv[1];
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc,argv);
// Get reference to Root POA.
CORBA::Object_var obj = orb ->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
// Activate POA manager
PortableServer::POAManager_var mgr = poa->the_POAManager();
mgr->activate();
// Create an object of Simple_If_Impl
Simple_If_Impl* simple_servant = new Simple_If_Impl();
PortableServer::ObjectId_var mySimpleId =
poa->activate_object(simple_servant);
ISimple_Interface_var siv = simple_servant->_this();
if( !bindSimpleToName(orb, siv) )
return 1;
// Write its stringified references to stdout
CORBA::String_var strSimple = orb->object_to_string(siv);
// Accept requests
orb->run();
}
//catch omitted
return 0;
More information about the omniORB-list
mailing list