Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

IDL member of a structure in C++

Within a structure, a string is mapped as though it were a sequence<char>, and a wstring as though it were a sequence. However, as strings and wstrings, the buffers are always required to be null terminated. The mapping for sequences within structures is detailed in IDL sequence in C++, part of which is duplicated here for clarity.

Assuming that the name of the declarator is dcl, the mapping is as follows:

  • A string is mapped as three members of the structure:
    char* dcl;
    int dclLen;
    int dclLenReq;
    
  • A wstring is mapped as two members of the structure:
    _wchar_t* dcl;
    int dclLen;
    int dclLenReq;
    

The second field ssnLen specifies the total size of the buffer ssn, in characters. After completion of the call in which the structure is used as an rout or inrout parameter, the third member is populated with the number of characters, null included, that would have been required to store the entire result. The memory for the buffer is allocated by the caller. For example:

struct Atm
{
  string ssn;
};

is mapped as:

struct Atm
{
  char* ssn;
  int ssnLen;
  int ssnLenReq;
};