WPADRegisterAllocator

C Specification

#include <revolution/wpad.h>

typedef void * ( *WPADAlloc )( u32  size );
typedef u8     ( *WPADFree  )( void *ptr );

void WPADRegisterAllocator( WPADAlloc alloc, WPADFree free );

Arguments

alloc The function used when allocating work memory during the initialization of the library.
free The function used when deallocating work memory during the termination of the library.

Return Values

None.

Description

Registers the allocator function that allocates and deallocates the library's work memory.Be aware that the allocator set by this function must reserve memory from MEM2.Be aware that this function must be called in advance of WPADInit. The library uses the allocator set at initialization to allocate work memory. Although the current library calls the allocator twice, the number of calls may be increased when more features are added in the future. Do not expect any limitations on the number of calls. In addition, the total amount of work memory that the library obtains can be gotten in advance using WPADGetWorkMemorySize.

size is passed to WPADAlloc as the size of the work memory needed by the library. WPADAlloc allocates that size of memory, and sets it such that its initial address will be returned from calls. The initial address of the memory to be deallocated is passed as ptr to WPADFree. WPADFree is set to return 1 if memory deallocation succeeds or 0 if it fails.

See Also

WPAD Functions
WPADInit
WPADGetWorkMemorySize

Revision History

08/15/2006 Added description of the allocator; added information about the WPAGGetWorkMemorySize function
06/19/2006 Initial version.


CONFIDENTIAL