OSDynLoad_GetAllocator

Syntax

#include <cafe/os/OSDynLoad.h>

typedef int  (*OSDynLoad_pfMemAlloc)(int aMemBytes, int aMemAlign, void **appRetPtr);
typedef void (*OSDynLoad_pfMemFree)(void *pAddr);

int OSDynLoad_GetAllocator(OSDynLoad_pfMemAlloc * apRetAlloc,
                           OSDynLoad_pfMemFree *  apRetFree);

Parameters

apRetAlloc Pointer to the function pointer variable to receive the address of the currently set allocator.
apRetFree Pointer to the function pointer variable to receive the address of the currently set deallocator.

Return Values

Returns an OSDYNLOAD_ERR_xxx error code (see OSDynLoad.h).

Description

Allows you to atomically get the allocator used by the loader to allocate read/write areas for the RPL files that are loaded.

The allocator function (OSDynLoad_pfMemAlloc) takes as arguments the number of bytes to allocate, the alignment, and a return pointer for the allocated block. A nonzero return code indicates an error. The alignment value may be negative. In this case, memory should be allocated at the highest address possible in whatever heap is used.

Calls to this function are atomic with respect to loaded files.

Memory allocated by the allocator is only ever freed using the corresponding deallocator. This is true even if the allocator/deallocator is changed after an initial allocation.

Do Not Call From

None.

See Also

OSDynLoad_Acquire
OSDynLoad_AddNotifyCallback
OSDynLoad_DelNotifyCallback
OSDynLoad_FindExport
OSDynLoad_FindTag
OSDynLoad_GetModuleName
OSDynLoad_IsModuleLoaded
OSDynLoad_Release
OSDynLoad_SetAllocator

Revision History

2013/11/01 Added OSDynLoad_IsModuleLoaded.
2013/05/08 Automated cleanup pass.
2011/03/11 Initial version.


CONFIDENTIAL