[omniORB] Problems with String_var

Richard Hardgrave hardgrav@ttd.teradyne.com
Mon, 6 Aug 2001 08:54:32 -0500 (CDT)


> From owner-omniorb-list@uk.research.att.com Mon Aug  6 07:12 CDT 2001
> From: jjeschin@phoenixcontact.com
> X-Lotus-FromDomain: PHOENIX
> To: omniorb-list@uk.research.att.com
> Date: Mon, 6 Aug 2001 14:01:02 +0200
> Subject: [omniORB] Problems with String_var
> Mime-Version: 1.0
> Content-Disposition: inline
> X-Loop: omniorb-list@uk.research.att.com
> 
> I am not familiar with CORBA and try to write my first server application under
> WinNT (VC++6.0). I try to pass a string from the client to the server.
> Client Code:
>   ...
>   CORBA::String_var src = (const char*)"/IP=149.208.19.219";
>   CORBA::Long hInst;
> 
>   ret = IPFBref->RegisterIPTime(hInst, src);
>   ...
> 
> Server Code:
> HRESULT IPFBORBServer_i::RegisterIPTime(CORBA::Long& hFBInst, const char*
> strPartner)
> {
>     printf("RegisterIPTime()\n");
>     hFBInst = 0;
>     return 0;
> }
> 
> When the string variable on the server side goes out of scope and the delete
> operator is called I get always a debug assertion:
> "_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)".
> What's my mistake?
> 
It's not obvious what's happening to the data your client is
passing to the servant, but if the servant were to do anything
with it, it would probably need to "string_dup()" the data.
Take a look at section 2.6 of the omniORB User's Guide,
"<top>/doc/omniORB/index.html".

Richard