REXX Language implementation
rxlink combines one or more .rxbin modules into a linked image with a shared constant pool. The result is still a normal 003 format record stream and can be loaded by rxvm, rxbvm, or passed on to rxcpack.
\fontspec{IBM Plex Mono} \begin{shaded} \small \obeylines \splice{rxlink -h | sed “s/&/\and/g”} \end{shaded} \fontspec{TeX Gyre Pagella}
The linker writes:
This reduces duplication across modules while preserving the module boundaries that the virtual machine still uses for load and runtime link work.
The simplest workflows can stop at rxas and run one or more .rxbin
files directly under rxvm. rxlink becomes useful when you want a
single deployable linked image:
rxcpack.rxbin
filesThe linker does not try to replace all runtime loading. It links the modules you give it, resolves what it can within that set, and leaves other imports available for later runtime resolution if that is how the program is designed.
The linker can be driven from the command line or from a control file.
-r selects one or more root modules directly.INCLUDE forces a module into the linked output even if it is not reached from the current roots.OMIT excludes a module from consideration.rxlink selects modules containing main.main, it falls back to the modules from the first input file.After roots are chosen, rxlink follows exposed imports, srcfproc
interface-factory references, and interface relationships to pull in the
modules needed by those roots.
In normal application linking, explicit roots are usually enough.
INCLUDE and OMIT are mainly for advanced scenarios:
Where a directive expects a module selector, rxlink accepts:
input_path::member for a specific member inside a multi-record inputThis is especially useful when one input file contains multiple linked or concatenated modules.
Control files are line-oriented and are useful when the link set is too
large or too deliberate to keep on one command line. Blank lines are
ignored, and lines beginning with * or # are treated as comments.
The supported directives are:
INPUT pathROOT selectorINCLUDE selectorOMIT selectorOUTPUT pathMAP pathSTRIP SOURCESelectors can use a module name, basename, stem, or input_path::member form.
The most common pattern is:
INPUT filesROOTSTRIP SOURCEOUTPUT* app.ctl
INPUT build/app.rxbin
INPUT build/library.rxbin
ROOT app
STRIP SOURCE
OUTPUT build/app_linked
This tells rxlink to start from module app, pull in the providers it
needs from the given inputs, strip source/file metadata, and write
build/app_linked.rxbin.
Run it with:
rxlink -c app.ctl
# app_with_optional_provider.ctl
INPUT build/app.rxbin
INPUT build/providers.rxbin
ROOT app
INCLUDE providers::fallback_logger
OUTPUT build/app_with_optional_provider
Here fallback_logger is forced into the linked image even if the normal
root/import walk would not select it. This is an advanced packaging tool:
useful when you know a module will be located indirectly or later than
the normal static reachability analysis can see.
* app_choose_provider.ctl
INPUT build/app.rxbin
INPUT build/provider_a.rxbin
INPUT build/provider_b.rxbin
ROOT app
OMIT provider_b
OUTPUT build/app_provider_a
This form is useful when you have alternative providers and want to make the choice explicitly at packaging time.
INPUT build/app.rxbin
INPUT build/library.rxbin
ROOT app
MAP build/app_linked.map
OUTPUT build/app_linked
The map file records which modules were selected and which imports, if any, remain unresolved inside the current link set.
rxlink strips inline-body metadata from linked output by default. Inline
metadata is intended for library artifacts consumed by rxc; it is not needed
after a final linked image has been built. Use rxlink -i to preserve it for
diagnostic or tooling builds. The equivalent control-file form is:
PRESERVE INLINE
rxlink -s strips source/file metadata from the linked output. The equivalent control-file form is:
STRIP SOURCE
This removes the serialized source/file metadata records while preserving runtime metadata such as exposed symbols and interface/class contract data.
This option is intended for deployable .rxbin artifacts and for downstream rxcpack / wrapped images where source breadcrumbs are not needed.
rxlink -o app linked_root.rxbin helpers.rxbin
rxvm app
To produce a smaller deployable linked image:
rxlink -s -o app_small linked_root.rxbin helpers.rxbin
The equivalent control-file driven form is:
INPUT linked_root.rxbin
INPUT helpers.rxbin
ROOT linked_root
STRIP SOURCE
OUTPUT app_small