<font style="font-family: arial,helvetica,sans-serif;" size="2">Hi,<br
/><br />i have downloaded the OmniOrb Package
"omniORB-4.1.2-x86_win32-vs8.zip" from Sourceforge.<br /><br
/>I'm new to CORBA so i've made a new Project in my Visual studio to
test it.<br /><br />The Problem is the i get the ErrorMessage <br /><br
/>"Windows has triggered a breakpoint in OmniOrbServer.exe.<br
/>This may be due to a corruption of the heap, and indicates a <br />bug
in OmniOrbServer.exe or any of the DLLs it has loaded.<br />The output
window may have more diagnostic information"<br /><br />I have made
things from Readme.win32.txt<br /><br />I set the Debug libs correct and
all runs well.<br /><br />Heres the Source-code : <br /><br />Server
:<br /><br />// OmniOrbServer.cpp : Defines the entry point for the
console application.<br />//<br /><br />#include "stdafx.h"<br
/><br />#include "Test.h"<br />#include <list><br
/>#include <string><br /><br /><br />#define NDEBUG<br /><br
/>#ifdef HAVE_STD<br /># include <iostream><br /> using
namespace std;<br />#else<br /># include <iostream><br
/>#endif<br /><br /> <br />using namespace HalloTest;<br />using
namespace CosNaming;<br />using namespace CORBA;<br />using namespace
PortableServer;<br /><br />class HelloServer : public
POA_HalloTest::Server<br />{<br />public:<br /><br /> inline
HelloServer() {}<br /> virtual ~HelloServer() {}<br /> inline virtual
char* getWorkflow ();<br />};<br /><br />using namespace std;<br /><br
/>char* HelloServer::getWorkflow ()<br />{<br /> String_var hallo =
(const char*) "Hallo"; <br /> return string_dup(hallo);<br
/>}<br /><br /><br /><br />int main(int argc, char** argv)<br />{<br
/> <br /> try {<br /> <br /> printf("Initialize Orb
with Paramenters :\n");<br />
printf("%s\n",argv[1]);<br />
printf("%s\n",argv[2]);<br /> // create and initialize the
orb<br /> ORB_var orb = ORB_init(argc, argv);<br /><br /> // get
POA reference and activate POA<br /> POA_var poa =
POA::_narrow(orb->resolve_initial_references("RootPOA"));<br
/> poa->the_POAManager()->activate();<br /><br /> // create
server instance and register it with the ORB<br /> HelloServer
*helloServer = new HelloServer();<br /><br /> // get the root naming
context<br /> NamingContext_var namingContext =<br />
NamingContext::_narrow(orb->resolve_initial_references("NameService"));<br
/><br /> // bind the Object Reference in Naming<br />
printf("Binding Service\n");<br /> Name path;<br />
path.length(1);<br /> path[0].id = (const char*) "Hello";
// string copied<br /> path[0].kind = (const char*) "";
// string copied<br /> namingContext->rebind(path,
helloServer->_this());<br /> printf("Starting
Server\n");<br /> printf("Server is running\n");<br
/> orb->run();<br /> } catch(CORBA::SystemException& ex) {<br
/> cerr << "Caught CORBA::" << ex._name()
<< endl;<br /> } catch(CORBA::Exception& ex) {<br /> cerr
<< "Caught CORBA::Exception: " << ex._name()
<< endl;<br /> } catch(omniORB::fatalException& fe) {<br
/> cerr << "Caught omniORB::fatalException:" <<
endl;<br /> cerr << " file: " << fe.file()
<< endl;<br /> cerr << " line: " <<
fe.line() << endl;<br /> cerr << " mesg: "
<< fe.errmsg() << endl;<br /> }<br /> return 0;<br />}<br
/><br /><br />Client :<br /><br /><br />#include "stdafx.h"<br
/><br />#include "Test.h"<br /><br />#ifdef HAVE_STD<br />#
include <iostream><br /> using namespace std;<br />#else<br />#
include <iostream><br />#endif<br /><br /><br /><br />using
namespace HalloTest;<br />using namespace CosNaming;<br />using
namespace CORBA;<br /><br /><br />int main (int argc, char **argv) <br
/>{<br /> try {<br /> <br /> printf("Initialize Orb with
Paramenters :\n");<br />
printf("%s\n",argv[1]);<br />
printf("%s\n",argv[2]);<br /> <br /> // create and
initialize the ORB<br /> ORB_var orb = ORB_init(argc, argv);<br /><br
/> // get the root naming context<br /> printf("Get Reference
to Nameservice\n");<br /> Object_var obj =
orb->resolve_initial_references("NameService");<br />
NamingContext_var ncRef = NamingContext::_narrow(obj);<br /> <br
/> // resolve the Object Reference in Naming<br /> CosNaming::Name
path;<br /> path.length(1);<br /> path[0].id = (const char*)
"Hello";<br /> path[0].kind = (const char*)
"";<br /> printf("Get Reference to
Server-Method\n");<br /> Server_var helloRemote =
Server::_narrow(ncRef->resolve(path));<br /> printf("Calling
server-Method\n");<br /> String_var helloMessage =
helloRemote->getWorkflow();<br /> cout << (const
char*)helloMessage << endl;<br /> <br />
gets(helloMessage);<br /> orb->destroy();<br /> }
catch(SystemException& ex) {<br /> cerr << "Caught a
CORBA::" << ex._name() << endl;<br /> <br /> }
catch(CORBA::Exception& ex) {<br /> cerr << "Caught
CORBA::Exception: " << ex._name() << endl;<br /> <br
/> } catch(omniORB::fatalException& fe) {<br /> cerr <<
"Caught omniORB::fatalException:" << endl;<br /> cerr
<< " file: " << fe.file() << endl;<br />
cerr << " line: " << fe.line() << endl;<br
/> cerr << " mesg: " << fe.errmsg() <<
endl;<br /> <br /> }<br /> return 0;<br />}<br /><br /><br />The
Client calls the Server-Method getWorkflow() and then the Server crashes
and gives the Message "Windows breakpoint..." as described
above.<br /><br />This happends only in debug. If i run the exe in
DOS-Box all works well.<br /><br />Thanks for any help on this topic
;-)<br /><br />Greetings Jochen<br /></font>