Dynamic Loading Overview

The Cafe SDK dynamic loading APIs acquire, load, release and perform various procedures on RPLs and RPXs. This topic describes the available procedures that can be performed when using the dynamic loading APIs.

Dynamic Loading APIs

API Usage
OSDynLoad_Acquire The primary RPL loader. The function loads the base module, and returns the handle to the loaded module.
OSDynLoad_AcquireContainingModule Loads an RPL module that contains an object and returns its handle.
OSDynLoad_AddNotifyCallback Used to add a generic callback that is invoked when a module is loaded or unloaded.
OSDynLoad_DelNotifyCallback Removes a previously registered callback.
OSDynLoad_FindExport Finds code or data that was exported by a loaded RPL.
OSDynLoad_FindTag Finds a tag that was attached to an RPL at the MakeRPL stage.
OSDynLoad_GetAllocator Atomically gets the allocator that is used by the loader to allocate read/write areas for the loaded RPL files.
OSDynLoad_GetLoaderHeapStatistics Returns statistics for heaps that are used by the loader at the time the function is called.
OSDynLoad_GetModuleName Gets the name of the loaded RPL module.
OSDynLoad_GetNumberOfRPLs Gets the number of modules that are loaded.
OSDynLoad_GetRPLInfo Fill the array that is referenced by infobuffer with a maximum of count elements, beginning with the module (RPX or RPL) with index index.
OSDynLoad_IsModuleLoaded Get the handle to a loaded RPL.
OSDynLoad_Release Releases an RPL that was previously loaded into memory or supplementally acquired.
OSDynLoad_SetAllocator Atomically sets the allocator that is used by the loader to allocate read/write areas for the RPL files that are loaded.
WARNING:
Do not set thread affinity to OS_THREAD_ATTR_AFFINITY_NONE for any thread that may make a call to any OSDynLoad* function. Loading an RPL can fail if the calling thread has affinity OS_THREAD_ATTR_AFFINITY_NONE.

Demo

The following path contains a demo on using dynamic loading for modifying a character:

($CAFE_ROOT)/system/src/demo/dynload/mod_char

The dynload demo, has a set of makefiles and sample code that produce an RPX and a pair of RPLs. The makefile for the RPX application binary can be found at:

($CAFE_ROOT)/system/src/demo/dynload/mod_char/game/Makefile

The makefiles that create the RPL modules can be found at:

($CAFE_ROOT)/system/src/demo/dynload/mod_char/char1/makefile.sub

($CAFE_ROOT)/system/src/demo/dynload/mod_char/char2/makefile.sub

See Also

Cafe Core OS (COS) API Functions

Revision History

2014/03/07 Creation.


CONFIDENTIAL