1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 9<title>WPADRegisterAllocator</title> 10</head> 11 12<body> 13 14<h1>WPADRegisterAllocator</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20<dd><pre><code>#include <revolution/wpad.h> 21 22typedef void * ( *WPADAlloc )( u32 size ); 23typedef u8 ( *WPADFree )( void *ptr ); 24 25void WPADRegisterAllocator( WPADAlloc alloc, WPADFree free );</CODE></pre> 26 </dd> 27</dl> 28 29<h2>Arguments</h2> 30 31<TABLE border="1" > 32 <tr> 33<TD width="120" bgcolor="#ffffe8"><code><b><i>alloc</i></b></code></TD> 34<TD>The function used when allocating work memory during the initialization of the library.</TD> 35 </tr> 36 <tr> 37 <tr> 38<TD width="120" bgcolor="#ffffe8"><code><b><i>free</i></b></code></TD> 39<TD>The function used when deallocating work memory during the termination of the library.</TD> 40 </tr> 41 <tr> 42</table> 43 44<h2>Return Values</h2> 45 46<p>None.</p> 47 48<H2>Description</H2> 49<p> 50Registers the allocator function that allocates and deallocates the library's work memory. <font color="red"><b>Be aware that the allocator set by this function must reserve memory from MEM2.</b></font> Be aware that this function must be called in advance of <a href="./WPADInit.html"><CODE>WPADInit</CODE></a>. 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 <code>WPADGetWorkMemorySize</code></a>. 51</p> 52<p> 53<CODE>size</CODE> is passed to <code>WPADAlloc</code> as the size of the work memory needed by the library. <code>WPADAlloc</code> 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 <CODE>ptr</CODE> to <code>WPADFree</code>. <code>WPADFree</code> is set to return 1 if memory deallocation succeeds or 0 if it fails. 54</p> 55 56<h2>See Also</h2> 57<P> 58<A href="./toc.html" target="contents">WPAD Functions</A><br> <a href="./WPADInit.html"><code>WPADInit</code></a>, <a href="./WPADGetWorkMemorySize.html"><code>WPADGetWorkMemorySize</code></a> 59</P> 60 61<H2>Revision History</H2> 62<P> 632006/08/15 Added description of the allocator; added information about the <code>WPAGGetWorkMemorySize</code> function<br>2006/06/19 Initial version.<br> 64</P> 65 66<hr> 67<P>CONFIDENTIAL</p> 68</BODY> 69</HTML>