Custom Memory Allocation

Specifies custom memory-allocation functions. More...

Typedefs

typedef A3DPtr(* A3DCallbackMemoryAlloc) (size_t)
 
typedef A3DVoid(* A3DCallbackMemoryFree) (A3DPtr)
 
typedef A3DStatus(* PFA3DDllSetCallbacksMemory) (A3DCallbackMemoryAlloc, A3DCallbackMemoryFree)
 Specifies custom memory-allocation functions This function specifies callback functions the library uses for memory allocation and and deallocation. More...
 

Detailed Description

Specifies custom memory-allocation functions.

This section describes the function and types that enable you to specify custom memory-allocation functions that the library uses in place of the standard malloc and free functions.

Typedef Documentation

◆ A3DCallbackMemoryAlloc

typedef A3DPtr(* A3DCallbackMemoryAlloc) (size_t)

A callback function the library invokes to allocate memory.

Version
2.0

◆ A3DCallbackMemoryFree

typedef A3DVoid(* A3DCallbackMemoryFree) (A3DPtr)

A callback function the library invokes to free memory.

Version
2.0

◆ PFA3DDllSetCallbacksMemory

typedef A3DStatus( * PFA3DDllSetCallbacksMemory) (A3DCallbackMemoryAlloc, A3DCallbackMemoryFree)

Specifies custom memory-allocation functions This function specifies callback functions the library uses for memory allocation and and deallocation.

If this function is not called, the standard malloc and free functions are used for memory allocation and deallocation.

Version
2.0
Sample code
A3DPtr my_alloc(A3DUns32 uiSize) { return malloc(uiSize); }
A3Dvoid my_free(A3DPtr ptr) { if (ptr) free(ptr); }
A3DInt32 iMajorVersion,iMinorVersion = 0;
iErr = A3DDllGetVersion( &iMajorVersion, &iMinorVersion );
iErr = A3DDllInitialize( A3D_DLL_MAJORVERSION, A3D_DLL_MAJORVERSION );
if ( iErr == A3D_SUCCESS )
{
iErr = A3DDllSetCallbacksMemory( my_alloc , my_free );
iErr = A3DDllTerminate();
}
Returns
A3D_SUCCESS in case of success or an error code
Return values
A3D_INITIALIZE_NOT_CALLED
A3D_CALLBACK_MEMORY_FUNCTIONS_ALREADY_SET
A3D_SUCCESS