aclrtAllocatorSetAllocFuncToDesc

Description

Sets the callback function for allocating memory blocks when the user-provided Allocator is used.

Prototype

aclError aclrtAllocatorSetAllocFuncToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocatorAllocFunc func)

Parameters

Parameter

Input/Output

Description

allocatorDesc

Input

Pointer to the Allocator descriptor.

Call aclrtAllocatorCreateDesc to set the Allocator description in advance.

func

Input

Callback function for allocating memory blocks.

Callback function definition:

typedef void *(*aclrtAllocatorAllocFunc)(aclrtAllocator allocator, size_t size);

aclrtAllocator definition:

typedef void *aclrtAllocator;

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.