[omniORB] omniORB3 bug in any management
Viacheslav N Tararin
taras@deka.kp.km.ua
Thu, 20 Jan 2000 17:21:57 +0200
This is a multi-part message in MIME format.
--------------B23DEBFEB8406E6602746CFA
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Hi.
In may environment anyExample not work. It not started anytime.
I make same "research", it's in attached files.
If file *DynSK.obj included in linker command line, *.exe file no start.
If file *DynSK.obj not included in linker line, all work properly.
In debug configuration *.exe not started at anyway.
Environment: WinNT4.0 SP3 VC6.0 omniORB3 (15.01.200).
This examples on omniORB2.8.0 work properly.
Regards.
--------------B23DEBFEB8406E6602746CFA
Content-Type: text/plain; charset=koi8-r;
name="eg1.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="eg1.cc"
// eg1.cc - This is the source code of example 1 used in Chapter 2
// "The Basics" of the omniORB2 user guide.
//
// In this example, both the object implementation and the
// client are in the same process.
//
// Usage: eg1
//
#include <iostream.h>
#include <echo.hh>
// This is the object implementation.
class Echo_i : public POA_Echo,
public PortableServer::RefCountServantBase
{
public:
inline Echo_i() {}
virtual ~Echo_i() {}
virtual char* echoString(const char* mesg);
};
char* Echo_i::echoString(const char* mesg)
{
return CORBA::string_dup(mesg);
}
//////////////////////////////////////////////////////////////////////
// This function acts as a client to the object.
static void hello(Echo_ptr e)
{
if( CORBA::is_nil(e) ) {
cerr << "hello: The object reference is nil!\n" << endl;
return;
}
CORBA::String_var src = (const char*) "Hello!";
// String literals are (char*) rather than (const char*) on some
// old compilers. Thus it is essential to cast to (const char*)
// here to ensure that the string is copied, so that the
// CORBA::String_var does not attempt to 'delete' the string
// literal.
CORBA::String_var dest = e->echoString(src);
cerr << "I said, \"" << (char*)src << "\"." << endl
<< "The Echo object replied, \"" << (char*)dest <<"\"." << endl;
}
//////////////////////////////////////////////////////////////////////
int main(int argc, char** argv)
{
try {
// Initialise the ORB.
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
// Obtain a reference to the root POA.
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
// We allocate the object on the heap. Since this is a reference
// counted object, it will be deleted by the POA when it is no
// longer needed.
Echo_i* myecho = new Echo_i();
// Activate the object. This tells the POA that this object is
// ready to accept requests.
PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);
// Obtain a reference to the object.
Echo_var myechoref = myecho->_this();
// Decrement the reference count of the object implementation, so
// that it will be properly cleaned up when the POA has determined
// that it is no longer needed.
myecho->_remove_ref();
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
// Do the client-side call.
hello(myechoref);
// Clean up all the resources.
orb->destroy();
}
catch(CORBA::COMM_FAILURE& ex) {
cerr << "Caught system exception COMM_FAILURE -- unable to contact the "
<< "object." << endl;
}
catch(CORBA::SystemException&) {
cerr << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&) {
cerr << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
cerr << "Caught omniORB::fatalException:" << endl;
cerr << " file: " << fe.file() << endl;
cerr << " line: " << fe.line() << endl;
cerr << " mesg: " << fe.errmsg() << endl;
}
catch(...) {
cerr << "Caught unknown exception." << endl;
}
return 0;
}
--------------B23DEBFEB8406E6602746CFA
Content-Type: application/x-unknown-content-type-idlfile;
name="echo.idl"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="echo.idl"
I2lmbmRlZiBfX0VDSE9fSURMX18NCiNkZWZpbmUgX19FQ0hPX0lETF9fDQoNCmludGVyZmFj
ZSBFY2hvIHsNCiAgc3RyaW5nIGVjaG9TdHJpbmcoaW4gc3RyaW5nIG1lc2cpOw0KfTsNCg0K
aW50ZXJmYWNlIEFueVRlc3Qgew0KICAgIHZvaWQgdGFrZV9hbnkoIGluIGFueSBhICk7DQp9
Ow0KDQojZW5kaWYgDQo=
--------------B23DEBFEB8406E6602746CFA
Content-Type: text/plain; charset=koi8-r;
name="dir.mak"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dir.mak"
#
# Usage:
# nmake /f dir.mk [<build option>]
#
# <build option>:
# all - build all executables
# clean - delete all executables and obj files
# veryclean - clean plus delete all stub files generated by omniidl3
#
#
# Pre-requisite:
#
# Make sure that you have environment variable LIB and INCLUDE setup for
# using Developer studio from the command line. Usually, this is accomplished
# by source the vcvars32.bat file.
#
# Where is the top of this distribution. All executable, library and include
# directories are relative to this variable.
#
TOP = ..\..\..
##########################################################################
# Essential flags to use omniORB.
#
DIR_CPPFLAGS = -I. -I$(TOP)\include
#
#
CORBA_CPPFLAGS = -D__WIN32__ -D__x86__ -D__NT__ -D__OSVERSION__=4
CORBA_LIB = omniORB300_rt.lib omnithread2_rt.lib omniDynamic300_rt.lib wsock32.lib \
advapi32.lib \
-libpath:$(TOP)\lib\x86_win32
CXXFLAGS = -O2 -MD -GX $(CORBA_CPPFLAGS) $(DIR_CPPFLAGS)
CXXLINKOPTIONS =
.SUFFIXES: .cpp .cc
.cpp.obj:
cl /nologo /c $(CXXFLAGS) /Tp$<
.cc.obj:
cl /nologo /c $(CXXFLAGS) /Tp$<
########################################################################
# To build debug executables
# Replace the above with the following:
#
#CORBA_CPPFLAGS = -D__WIN32__ -D__x86__ -D__NT__ -D__OSVERSION__=4
#CORBA_LIB = omniORB300_rtd.lib omnithread2_rtd.lib omniDynamic300_rtd.lib wsock32.lib \
# advapi32.lib -libpath:$(TOP)\lib\x86_win32
#CXXFLAGS = -MDd -GX -Z7 -Od $(CORBA_CPPFLAGS) $(DIR_CPPFLAGS)
#CXXLINKOPTIONS = -debug -PDB:NONE
all:: eg1.exe
#>>>>>>>>>>>> next line not work <<<<<<<<<<<<<<<<<<<
# eg1.exe: echoSK.obj eg1.obj echoDynSK.obj
#>>>>>>>>>>>> next line work <<<<<<<<<<<<<<<<<
eg1.exe: echoSK.obj eg1.obj
link -nologo $(CXXLINKOPTIONS) -out:$@ $** $(CORBA_LIB)
clean::
-del *.obj
-del *.exe
veryclean::
-del *.obj
-del echoSK.* echo.hh
-del *.exe
echo.hh echoSK.cc echoDynSK.cc: echo.idl
$(TOP)\bin\x86_win32\omniidl3 -a -h .hh -s SK.cc echo.idl
--------------B23DEBFEB8406E6602746CFA--