CORBA::wstring_alloc

Overview Allocates storage for a string.
Original class CORBA


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::wstring_free(). Strings can also be copied using CORBA::wstring_dup().

WStrings to be passed on remote method invocations or whose ownership is to be transferred from one library to another should be allocated using this method (or CORBA::wstring_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 wchar_t* wstring_alloc(CORBA::ULong len);

Input parameters

len
The size of the string whose storage is to be allocated.

Return values

wchar_t*
The uninitialized wstring storage. This storage should later be freed using CORBA::wstring_free(). NULL is returned if the storage cannot be allocated.

Example

  /* The following is a C++ example */
  #include "corba.h"
  ...
  /* Allocate 8 wchars for string buf */
  wchar_t* buf = CORBA::wstring_alloc(8);
  /* String copy buf */
  wchar_t* buf_dup = CORBA::wstring_dup(buf);
  /* Use buf and buf_dup */
  ...
  /* Free buf and buf_dup */
  CORBA::wstring_free(buf);
  CORBA::wstring_free(buf_dup);

Related reference
CORBA module



Searchable topic ID:   rcor_modco8
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/ref/rcor_modco8.html

Library | Support | Terms of Use | Feedback