Go to the first, previous, next, last section, table of contents.


Determining if a Function is Executable

Since dld allows modules to be added to or removed from an executing process dynamically, some global symbols may not be defined. As a result, an invocation of a function might reference an undefined symbol. We say that a function is executable if and only if all its external references have been fully resolved and all functions that it might call are executable.

Function: int dld_function_executable_p (const char *func)
The predicate function dld_function_executable_p helps solve this problem by tracing the cross references between modules and returns non-zero only if the named function is executable.

Note that the implementation of dld_function_executable_p is not complete according to the (recursive) definition of executability. External references through pointers are not traced. That is, dld_function_executable_p will still return non-zero if the named function uses a pointer to indirectly call another function which has already been unlinked. Furthermore, if one external reference of a object module is unresolved, all functions defined in this module are considered unexecutable. Therefore, dld_function_executable_p is usually too conservative.

However, it is advisable to use dld_function_executable_p to check if a function is executable before its invocation. In such a dynamic environment where object modules are being added and removed, a function that is executable at one point in time might not be executable at another. Under most circumstances, dld_function_executable_p is accurate. Also, the implementation of this function has been optimized and it is relatively cheap to use.


Go to the first, previous, next, last section, table of contents.