a0NewBuffer()

Allocates memory and creates a new buffer.


Syntax

a0tError a0NewBuffer(
a0tBuffer *buffer,
int buftype,
size_t size );

Arguments

Namerd/wrDescription
buffer write Descriptor of the created buffer.
buftype read Type of the created buffer.
size read Size of the buffer.

Description

This function creates a buffer buffer allocating size bytes for its storage. Depending on the value of buftype, the created buffer is to be used as the input buffer of a remote thread (A0ThreadBufferType), a remote urgent call (A0UrgentBufferType) or a send/receive buffer ( A0SendBufferType).

A buffer with any type can be sent and received. Only buffers of type A0ThreadBufferType can be used to start remote threads, with a0StartRemoteThread(). Only buffers of type A0UrgentBufferType can be used to remote urgent calls, with a0StartRemoteUrgent().

All calls to a0Pack() and a0Unpack() functions receive as parameter a buffer descriptor.

On return of this function, the variable pointed by buffer contains a buffer descriptor with the requested storage size.


Return Values

If an error condition occurs, it returns the error code, otherwise it returns A0ErrOk. Possible values are as follows:
Error CodeDescription
A0Err...Some error occurred.
A0ErrOkSuccessful completion.

See Also

a0ClearBuffer() a0DisposeBuffer() a0NewBufferStorage() a0Pack() a0Unpack() a0SendBuffer() a0ReceiveBuffer() a0StartRemoteThread() a0StartRemoteUrgent()