#include <revolution/rso.h>
#include <revolution/RSOLink.h>
int RSOLinkFar(RSOObjectHeader* rsoImp,const RSOObjectHeader* rsoExp,void *buff);
rsoImp |
Pointer to the module information to link. |
rsoExp |
Pointer to the module information to reference. |
buff |
Area in which to write the added code. |
The number of processed codes.
Typically, the branch instructions (bx) have only a 28-bit offset (± 32 MB). Therefore, when a dynamic module is placed in external main memory (MEM2), functions in internal main memory (MEM1) cannot be accessed.
Use RSOLinkFar to link between the two.
The LinkFar function in the demo outputs the relay jump code to buff. It enables access from the external module by linking to the code from rsoImp.
Request the necessary buffer size with RSOGetFarCodeSize.
Note: Allocate buffer from the same main memory (MEM2 or MEM1) as the referencing module (rsoImp).
In addition, normally after linking, the code in the module is overwritten. Thus, when using RSOLinkListFixed, proceed up to RSO_FL_INTERNAL at the release stage.
Whereas in RSOLinkJump, the relay jump code is dependent on the module that is referred to, RSOLinkFar is dependent on the referring module.
This is an effective method when the module referring across memory areas is known.
RSO API Introduction
RSOGetFarCodeSize
2006/12/19 Added an explanation for the difference from RSOLinkJump.
2006/09/25 Initial version.