RPX/RPL Cross-Referencing

Overview

Exporting and importing symbols simultaneously between two modules is known as cross-referencing. Despite the risk of creating circular dependencies, this is a useful capability for Cafe's RPX/RPL model. The following describes how to cross-reference symbols across modules.

IMPORTANT:
The following descriptions reference the Examplemake demo package. The package demonstrates various aspects of the build system, including the latest RPL tool enhancements as they relate to cross-referencing. The version of Examplemake included in the SDK is compatible with the current SDK. For comparison with older SDK versions, obtain the Examplemake package from your local Nintendo developer support group.

Build Time Resolution of Cross References

The RPL tools allow an import library to be defined from a text file. This means the import library can be created without inducing compilation and link.

To build an import library, an export definition file must be indicate which symbols are to be exported, and must designate those symbols as code or data.

For example, hello.def from the Examplemake demo helloworld_rpl looks like:

# Separate code and data objects to support building interfaces before compiling

[DATA]
# Put all exported data objects after the [DATA] directive
hello

[CODE]
# Put all exported code objects after the [CODE] directive
rpx_gethello

To make it easier to build initial export lists a new script rplexportall will generate an export list from a set of object and library files. For example:

$ rplexportall hello.o

produces

; Generated Export List

[CODE]
main                                    ; main
rpx_gethello                            ; rpx_gethello

[DATA]
hello                                   ; hello
NOTE:
This requires post-editing as we do not want to export main.

Also if any of the symbols were in C++ the unmangled version of the name appears in the comment. For example:

$ rplexportall cpp_exception_threads.o

Produces

; Generated Export List

[CODE]
do_test__FUi                            ; do_test(unsigned int)
main                                    ; main
thread_func__FiPv                       ; thread_func(int, void *)

[DATA]
core1_thread_stack                      ; core1_thread_stack
gStartEvent                             ; gStartEvent
gThreadCount                            ; gThreadCount
__TID_c                                 ; type identifier for char
__TID_i                                 ; type identifier for int
__TID_v                                 ; type identifier for void

Link-time Solution

Cross-referencing in the v1.0 RPL tools is performed by running preprpl[32|64] to generate all import libraries before running the linker.

For information on how to export symbols when building RPXs and RPLs, see the MAN pages for the makerpl[32|64] and preprpl[32|64] tools.

For information on how to find and use exported symbols from another module at runtime, see the OSDynLoad_FindExport reference.

See Also

RPX/RPL Developer Overview
Building with Examplemake
makerpl[32|64]
preprpl[32|64]
dumprpl

Revision History

2013/05/08 Automated cleanup pass.
2012/07/23 Removed old SDK and RPL tool references.
2011/10/19 Examplemake addition.
2011/02/21 Initial version.


CONFIDENTIAL