Sizespec

Sizespec can be used in combination with numeric formal parameters of type long or number. It may only be specified along with an in or inout parameter. The actual value of the sizespec parameter is taken as size specification for buffers. As such, its semantics are only applied to the next inout or out stringformal parameter on the left.

Formal parameters declared with the sizespec modifier allow actual parameters to be 0 or STRING_COMPLETE. If one of these values is used, Silk Performer's runtime calculates the actual size of the next string parameter on the left and sets this parameter accordingly. If the actual parameter specifies a size that is more than the actual size of the corresponding string parameter, the variable is automatically resized to the specified size.

Example

dll "some.dll"
  "GetData"
    function GetData(sBuffer : out string,
                     nBufferLen : in number sizespec
optional);

dcltrans
  transaction TMain
  var
    sBuffer : string;
  begin
    // sBuffer unmodified, nBufferLen = 253
    GetData(sBuffer);
    // sBuffer unmodified, nBufferLen = 253
    GetData(sBuffer, STRING_COMPLETE);
    // sBuffer unmodified, nBufferLen = 12
    GetData(sBuffer, 12);
    // sBuffer is resized, nBufferLen = 40000
    GetData(sBuffer, 40000);
  end TMain;