[omniORB] Problem of CORBA::String in MFC Application

Ji-Yong D. Chung virtualcyber@erols.com
Fri, 26 Nov 1999 12:13:42 -0500


Guy,

You have given the following example:

void FunctionA()
{ 
    CORBA::String_var src = "A string"; // Will cause an error since "..." 
is a char* 
                                                         // and ~CORBA::String_var will try to delete 
                                                        // the actual char* 
  
    CORBA::String_var src2 = (const char*)"A string"; // Will make a copy of the string 
} 


    It seems to me, if there is CORBA::String_var::operator=(const char *), both of the preceding statements should yield the same result.  In the first assignment, conversion should should occur, and String_var src should have, via its operator=, a copy of "A String" in its internal buffer.  I have written reference counted string packages using MSVC++, and there is absolutly no problem, whether I use the first or the second statement.

    I will be grateful for further elaboration.

--------------------

    As for the problem pointed out by Jeffrey Yu, I had similar experience, and this was caused by the fact that I was linking some of the dll's with static libs, and others with dll libs. 

    This is consistent with the preceding e-mail sent by Renzo Tomaselli on the same subject matter.