Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Memory & File Interfaces
[Initialization & Resource Management]


Data Structures

struct   RwFileFunctions
struct   RwMemoryFunctions

Defines

#define  RwMalloc(_s)   ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s)))
#define  RwFree(_p)   ((RWSRCGLOBAL(memoryFuncs).rwfree)((_p)))
#define  RwCalloc(_n, _s)   ((RWSRCGLOBAL(memoryFuncs).rwcalloc)((_n), (_s)))
#define  RwRealloc(_p, _s)   ((RWSRCGLOBAL(memoryFuncs).rwrealloc)((_p),(_s)))

Functions

RwFileFunctions RwOsGetFileInterface (void)
RwMemoryFunctions RwOsGetMemoryInterface (void)

Detailed Description

Operating System

Memory & File Interfaces Overview

Requirements

Overview

This object exposes the file and memory interfaces to the application.

RenderWare maintains tables of file I/O and memory handling functions. The prototypes are based on standard ANSI functionality. Developers are allowed to change individual entries in these tables so that they can provide their own functions.

Extreme care should be taken with these functions as memory leaks or data corruption may occur if this feature is misused. RwEngineInit() can be used instead of these functions if you only need to change the functions once, when your application starts.


Define Documentation

#define RwCalloc _n,
_s       ((RWSRCGLOBAL(memoryFuncs).rwcalloc)((_n), (_s)))
 

RwCalloc(_n, _s) is a macro for calloc(_n, _s).

#define RwFree _p       ((RWSRCGLOBAL(memoryFuncs).rwfree)((_p)))
 

RwFree(_p) is a macro for free(_p).

#define RwMalloc _s       ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s)))
 

RwMalloc(_s) is a macro for malloc(_s).

#define RwRealloc _p,
_s       ((RWSRCGLOBAL(memoryFuncs).rwrealloc)((_p),(_s)))
 

RwRealloc(_p, _s) is a macro for realloc(_p, _s).


Function Documentation

RwFileFunctions* RwOsGetFileInterface void   
 

RwOsGetFileInterface is used to retrieve the file system functions used by RenderWare. The default file system interface is installed when the rendering engine is initialized and uses the standard ANSI functions if implemented. The application may install an alternative file system interface providing it complies with the ANSI interface. This new interface will be used by all subsequent RenderWare file operations.

See RwFileFunctions for details of the file interface.

Returns:
Returns pointer to a RwFileFunctions value containing pointers to file system access functions. The elements of this structure may be modified directly to install an alternative file system.
See also:
RwOsGetMemoryInterface , RwEngineInit
RwMemoryFunctions* RwOsGetMemoryInterface void   
 

RwOsGetMemoryInterface is used to retrieve the memory functions used by RenderWare. By default the standard ANSI functions are used. The application may install an alternative interface providing that it is ANSI compliant.

If an application wishes to completely overload the memory interface then this can be achieved via the RwEngineInit API function which guarantees that the overload takes place before any memory allocation. The memory function pointers should not be manipulated directly.

Note that since RenderWare allocates and frees memory in an asynchronous fashion it is not possible to install a completely different memory handler once the library has been initialized. It is, however, possible to install a daisy chained handler that gathers statistics before calling the default.

See the section RenderWare Data Types for details of the memory interface.

Returns:
Returns pointer to a RwMemoryFunctions value containing pointers to memory access functions. The elements of this structure may be modified directly to install an alternative memory interface.
See also:
RwEngineInit , RwOsGetFileInterface

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:13 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)