OpenSpirit enable cross-vendor, cross platform... Integration of Data and Applications
About Us Products Support Services Clients News Contact Us
Developer FAQ: Version 2.5.0 Developer FAQ Menu

Applications >> C++ Tips

What are some of the memory management issues?
Why isn't my C++ application receiving OpenSpirit events?
How is persistence of IORs supported for C++ clients?

What are some of the memory management issues?

Memory management issues to watch for in a C++ client application are:

  • The method xx::_narrow() returns a new object reference. Therefore, the return object needs to be assigned to a xx_var variable. For example:

  EpEntity::Entity_var entity = ...
EpiWell::Well_var =
EpiWell::Well::_narrow(entity);

  • The object reference in the CORBA::Any is owned by the Any. Therefore, the extracted object cannot be assigned to a xx_var variable. It needs to be assigned to a xx_ptr variable instead.
  • If a method on a CORBA object returns a CORBA object, the returned object must be assigned to an xx_var variable so that its memory can be freed when it is no longer in use. For example:

  EpiWell::Well_var well = ...;
EpiProject::Project_var project =
well->getProject();

  • If a method on a CORBA object returns a string (char *), the string needs to be assigned to a CORBA::String_var variable so that its memory can be freed when it is no longer in use. For example:

  EpiProject::Project_var project = ...
CORBA::String_var name = project->getName();

  • Exception variable in the catch block should be declared const &. For example:

  try {
...
}
catch (const CORBA::Exception& e) {
...
}

Back to Top ...

Why isn't my C++ application receiving OpenSpirit events?

On Unix platforms:

The MICO object request broker is currently used on all supported Unix platforms.

Is the hostname of the machine where you run your C++ application recognizable by the machine running your OpenSpirit shared services? (You can test this with 'ping'). If your machine that runs your C++ application is recognizable only by the IP address, you need to uncomment the line that says -ORBNoResolve in the micorc.txt file in $OSP_HOME/bin/etc. After the change, the file will resemble the following:

 # List the Mico orb options to use
# in this file.
# Separate the options with spaces
#
# uses IpAddress instead of hostname in IOR
#
-ORBNoResolve
#
# Turn debug on for ORB
#
# -ORBDebugLevel 2

This '-ORBNoResolve' option tells the MICO ORB not to resolve the IP address to a hostname in the CORBA object reference.

On Windows:

The VisiBroker object request broker is used on the Windows platform, and the above MICO option does not apply.

If you are VPN'ed into another network, please see the VPN FAQ.

Back to Top ...

How is persistence of IORs supported for C++ clients?

We are not using the Visibroker activation daemon to start the per-userid data servers. The data servers are automatically started by your UserServer when you issue queries or find factories, but currently we are not starting them when the session is reactivated. You can work around this problem by calling the getAllServers() operation on the session's project set when you re-connect to the session. This will cause all of the data servers needed by the project set to be started.

Back to Top ...

Site Map      Legal      Privacy
Planning Well
OpenSpirit Home