#include <revolution/wpad.h> typedef void * ( *WPADAlloc )( u32 size ); typedef u8 ( *WPADFree )( void *ptr ); void WPADRegisterAllocator( WPADAlloc alloc, WPADFree free );
| 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. |
None.
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 before the WPADInit function. 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 place any restrictions on the number of calls. In addition, the total amount of work memory that the library obtains can be obtained in advance using the WPADGetWorkMemorySize function.
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.
WPADInit, WPADGetWorkMemorySize
2006/08/15 Added a description of the allocator, and a description of the WPADGetWorkMemorySize function.
2006/06/19 Initial version.
CONFIDENTIAL