Intended Usage
This method is intended to be used by client and server applications to dynamically allocate storage for data of type CORBA::String. The returned storage should subsequently be freed using CORBA::string_free(). Strings can also be copied using CORBA::string_dup().
Strings to be passed on remote method invocations or whose ownership is to be transferred by one library to another should be allocated using CORBA::string_alloc() (or CORBA::string_dup()) rather than the C++ new[] operator. This insures that string memory is deleted using the same C++ run time that originally allocated it.
Syntax
static char* string_alloc(CORBA::ULong len);
Input parameters
Return values
Example
/* The following is a C++ example */ #include "corba.h" ... /* Allocate 8 byes for string buf */ char* buf = CORBA::string_alloc(8); /* String copy buf */ char* buf_dup = CORBA::string_dup(buf); /* Use buf and buf_dup */ ... /* free buf and buf_dup */ CORBA::string_free(buf); CORBA::string_free(buf_dup);