relaytool(1) Generate a file that can be used instead of linking directly against a library


relaytool [OPTION ...] [LINKER COMMAND ...]


This manual page documents briefly the relaytool command.

relaytool is a program to provide a more convenient interface to dlopen/dlsym. It lets you write the same style of code you would when using a normal hard link (-lwhatever), but the symbols are actually lazy-linked at runtime. You can use the symbols libwhatever_is_present and libwhatever_symbol_is_present() to find out what APIs are actually available at runtime.

In other words, the need to use function pointers and lots of manual calls to dlsym() is eliminated, and it becomes much simpler to soft link to things as a result. If a symbol is missing at runtime and you call it anyway, your application will abort and an error message is printed that states which function was called. If a variable is missing at runtime, the value is always -1.


--relay LIB

If a matching -lLIB is found, generate a file that can be used instead of linking directly to LIB. The name of the file is echoed on stdout. Multiple --relay can be used together, a file will be generated for each matching ones.


Generate a file for every -lLIB parameter.

--minimal-list OBJ_LIST

Will look in OBJ_LIST for undefined symbols, and generate a file creating only the needed symbols for each LIB.

--partial-map MAP_FILE

Generate a file creating only the symbols contained in MAP_FILE. Will apply to all further -lLIB parameters, so in general is not suitable to multiple libs in the same invocation of relaytool.


Echo -lLIB on stdout even if a --relay LIB is found, so it'll be linked in normally.

--multilink [SONAMES...]

If a library has different SONAMES on different Linux distributions you can specify the various SONAMES that it's known by here. Relaytool will attempt to load them (in the order provided) until one if found. This cannot be used with multiple --relay options. The first SONAME in the list will be used as the name in the _is_present variable and _symbol_is_present function.

--out-dir DIRECTORY

Write stub file to DIRECTORY instead of CWD.



Add PATH to the list of paths to search for LIBs.


If a matching --relay LIB is found (or if --replace-all-libs is specified), generate a file that can be used instead of linking directly to LIB. If there's no --relay LIB, echo -lLIB to stdout.

All other linker commands are passed as is to stdout.


-h, --help

Show some help.


Display version information of relaytool


This manual page was written by Matthias Klumpp <[email protected]>.


Copyright © 2009-2012 Matthias Klumpp