The special handles RTLD_DEFAULT, and RTLD_PROBE enable an application to test for the existence of another symbol. The symbol search follows the same model as used to relocate the calling object. See Default Symbol Lookup Model. For example, the application prog can contain the following code fragment.
if ((fptr = (int (*)())dlsym(RTLD_DEFAULT, "foo")) != NULL) (*fptr)();
In this case, foo is searched for in prog, followed by /lib/libc.so.1. If this code fragment was contained in the file B.so.1 from the example that is shown in Figure 3–1, then the search for foo continues into B.so.1 and then C.so.1.
This mechanism provides a robust and flexible alternative to the use of undefined weak references, as discussed in Weak Symbols.