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<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/wpad.h> 19 20typedef void * ( *WPADAlloc )( u32 size ); 21typedef u8 ( *WPADFree )( void *ptr ); 22 23void WPADRegisterAllocator( WPADAlloc alloc, WPADFree free ); 24</pre></dd></dl> 25 26<h2>Arguments</h2> 27<TABLE class="arguments" border="1" > 28 <tr> 29<TH>alloc</TH> 30<TD>The function used when allocating work memory during the initialization of the library.</TD> 31 </tr> 32 <tr> 33<TH>free</TH> 34<TD>The function used when deallocating work memory during the termination of the library.</TD> 35 </tr> 36</table> 37 38<h2>Return Values</h2> 39<p>None.</p> 40 41<H2>Description</H2> 42<p> 43Registers 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 before the <a href="./WPADInit.html"><CODE>WPADInit</CODE></a> 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 <a href="./WPADGetWorkMemorySize.html"><code>WPADGetWorkMemorySize</code></a> function. 44</p> 45<p> 46<SPAN class="argument">size</SPAN> 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 <SPAN class="argument">ptr</SPAN> to <code>WPADFree</code>. <code>WPADFree</code> is set to return 1 if memory deallocation succeeds or 0 if it fails. 47</p> 48 49<h2>See Also</h2> 50<P class="reference"> 51<a href="./WPADInit.html">WPADInit</a>, 52<a href="./WPADGetWorkMemorySize.html">WPADGetWorkMemorySize</a> 53</P> 54 55<H2>Revision History</H2> 56<P> 572006/08/15 Added a description of the allocator, and a description of the <CODE>WPADGetWorkMemorySize</CODE> function.<br>2006/06/19 Initial version.<br> 58</P> 59 60<hr><p>CONFIDENTIAL</p></body> 61</html>