[omniORB] string problem

Bart van den Eijnden bart@geodan.nl
Mon, 26 Mar 2001 18:50:56 +0200


Hi,

I have a problem with strings:
- the function g_SrcMan->SourceMnemonic(index) results in a const char*
-if I call the GetMnemonic function several times and use string_alloc,
I only get one record back
-if I use the string_dup method instead, I only get a few records, until
some kind of buffer is full (?)
-if I combine both (I have a memory leak) but it works, then if I call
the client twice the second time I don't get anything back anymore. When
I restart the server it's ok.

Can anyone help?

This is the implementation
char* GeoDataset_i::GetMnemonic(int32 index)
{
 char* ret = CORBA::string_alloc(80);
   ret = (char*) g_SrcMan->SourceMnemonic(index);
 //char* ret = CORBA::string_dup(g_SrcMan->SourceMnemonic(index));
 return ret;
}

This is the client:
CORBA::String_var ret = gds->GetMnemonic(i);
std::cerr << "The mnemonic of dataset " << i << " is: " << (char*) ret
<< std::endl;

--
Bart van den Eijnden
Geodan SDT BV

Vestiging Zuid
Buitenhaven 27-A
5211 TP 's-Hertogenbosch

Telefoon: 073-6925151
Fax: 073-6925150
Email: bart@geodan.nl
WWW: www.geodan.nl