Special Considerations When Passing Character Types - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Calling external libraries from procedures

Special considerations when passing character types

272
For the character data type (CHAR), Adaptive Server IQ allocates a 255-byte
buffer (including one for the null terminator) for each parameter. If the
parameter is an INOUT parameter, the existing value is copied into the buffer
and null terminated, and a pointer to this buffer is passed to the external
function. The external function should therefore not allocate a buffer of its own
for OUT or INOUT character parameters: the server has already allocated the
space. If the external function writes beyond the 256 bytes (including the
ending null character), it is writing over data structures in the server.
When the entry point returns, the parameter buffers are translated back into
their server data structure string equivalents based on the
buffer.
The external function should be sure to null-terminate any output string
parameters. OUT parameters follow the same procedure except that as there is
no initial data, no initial value of the output buffer parameter is guaranteed.
Always be sure to put a null byte into an OUT char parameter, as the lack of
one could cause problems if the out buffer happens to be allocated adjacent to
an area that is not in the allocate address space of the server.
value of the
strlen()

Advertisement

Table of Contents
loading

Table of Contents