Calling external libraries from procedures
272
Special considerations when passing character types
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
strlen()
value of 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.
Summary of Contents for Adaptive Server IQ 12.4.2
Page 1: ...Administration and Performance Guide Adaptive Server IQ 12 4 2 ...
Page 16: ...xvi ...
Page 20: ...Related documents xx ...
Page 40: ...Compatibility with earlier versions 20 ...
Page 118: ...Troubleshooting startup shutdown and connections 98 ...
Page 248: ...Importing data by replication 228 ...
Page 306: ...Integrity rules in the system tables 286 ...
Page 334: ...Cursors in transactions 314 ...
Page 396: ...Users and permissions in the system tables 376 ...
Page 438: ...Determining your data backup and recovery strategy 418 ...
Page 484: ...Network performance 464 ...
Page 500: ...System utilities to monitor CPU use 480 ...
Page 514: ...Characteristics of Open Client and jConnect connections 494 ...
Page 536: ...Index 516 ...