Resources | Resources |



IDL strings returning from a service to its caller in C++

The following apply to the request for the returned value–the three C parameters:

  • buffer pointer
  • buffer length
  • integer pointer in which to return the length of the buffer

  • If the caller wants to know the length of the string, but not get the string itself, pass 0 for the length of the buffer (the second) parameter. If you pass zero for the buffer length, you may pass NULL for the buffer pointer.
  • If the caller only wants the string, but not the length of the string, you may pass NULL as the third parameter. It is impossible to know whether the entire string is returned, so do this only if you know that your buffer is big enough.
  • The following apply to the returned string–the data copied to the buffer.
    • The same rules apply for the value of the string returned. A service can never return NULL or omitted strings to the caller–only an empty string.
    • No semantics can be hung off the distinction between the empty string and the omitted string.