[omniORB] string_dup() behavior

Lionel Gilet lgilet@san-jose.tt.slb.com
Thu Jul 11 22:07:01 2002


Hi,

Because of a typo I run into something that I found surprising.

{
  CORBA::String_var the String = CORBA::string_dup("name");
}

Using omniORB3 on Windows 2000, I got an Windows error when String_var
goes out of scope because the object destructor calls omni::freeString()
and Windows complains that the pointer is invalid.
If I use CORBA::String_var::string_dup("name") instead of
CORBA::string_dup("name") then everything is cool.

The problem disappear if you use static libraries instead of DLLs.

If someone has a good explanation and a few minutes to spare I would
really to like to understand what is going on.

Thank you

Lionel Gilet

Schlumberger / NPtest