Product SiteDocumentation Site

2.3. Relaytool

A program to provide a more convenient interface to dlopen/dlsym. It allows you to easily soft link to libraries.

2.3.1. What is Relaytool?

This 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.