OpenTP1 Version 7 TP1/Client User's Guide TP1/Client/W, TP1/Client/P

[Contents][Index][Back][Next]

4.8.1 tpalloc - Allocate typed buffer

Organization of this subsection
(1) Form
(2) Purpose
(3) Arguments set by UAPs
(4) Return values
(5) Notes

(1) Form

(a) TP1/Client/W
 
#include <dcvxatmi.h>
char *tpalloc(char *type, char *subtype, DCLONG size)
 
(b) TP1/Client/P
 
#include <dcvxatmi.h>
char CLTFAR *tpalloc(char CLTFAR *type, 
      char CLTFAR *subtype, DCLONG size)
 

(2) Purpose

Allocates the typed buffer.

Some types of buffer must be initialized before use. The tpalloc function initializes the buffer after the buffer is allocated until it returns. The buffer is returned to the issuer of the tpalloc function when issuance of a function becomes available.

Define the method of initialization by communication resource managers for TP1/Client and TP1/Server Base. If not defined, the tpalloc function does not initialize the buffer.

When the initialization completes successfully, the tpalloc function returns a pointer to a buffer of the appropriate type aligned on a long word. The function returns NULL if an error occurs; error information is returned as the return value. If initialization failed, the allocated buffer is released and NULL is returned.

(3) Arguments set by UAPs

(4) Return values

When the initialization completes successfully, the tpalloc function returns a pointer to a buffer of the appropriate type aligned on a long word. If an error occurs, the function returns NULL and sets one of the following values in tperrno as a return value to report the information about the error.

Return value Meaning
TPEINVAL Invalid argument
TPENOENT The value specified in the argument is not defined in the system.
TPEPROTO Inappropriate status for issuing the tpalloc function.
TPESYSTEM An error occurred in the communication resource manager.
TPEOS An error occurred in the operating system.

(5) Notes