LINKER

    Since:

    1.0

    Version:

    1.0

    Summary

    Files

    Macro Name and Value

    Description

    RTLD_LAZY    1

    All undefined symbols in the shared object are not resolved before dlopen() returns.

    RTLD_NOW    2

    All undefined symbols in the shared object are resolved before returns.

    RTLD_NOLOAD    4

    The shared object is not loaded. It can be used to test whether the object resides in the memory.

    RTLD_NODELETE    4096

    The shared object is not deleted during dlclose().

    RTLD_GLOBAL    256

    The symbols defined by the loaded shared object can be resolved by other shared objects opened later.

    RTLD_LOCAL    0

    The symbols defined by the loaded shared object cannot be resolved by other shared objects opened later.

    The next match of the required symbol is searched in the search order after the current object.

    RTLD_DEFAULT    ((void )0)

    The first match of the required symbol is searched in the default shared object search order. The search scope includes the global symbols of the program and its dependencies, and the global symbols loaded by the function.

    RTLD_DI_LINKMAP    2

    The pointer to the link_map structure of the specified handle.

    Functions

    Details

    dlclose()

    Description:

    Closes the DLL of a specified handle.

    Parameters:

    Description

    handle Indicates the loaded DLL handle.

    Attention:

    The symbols associated with the handle may not be removed from the caller’s address space even if the function returns. The symbols are removed only when the reference count of the DLL is 0. The reference count is incremented (by 1) each time the dlopen() function is explicitly called. In addition, the reference of DLL depended on by other DLLs or programs will be counted if it has been implicitly loaded. A shared object can be removed from the address space only after all references are released.

    Returns:

    Returns 0 if the operation is successful; returns a non-zero value if the operation fails.

    dlerror()

    Description:

    Obtains the latest error that occurred during a DLL function execution failure.

    Returns:

    Returns the error if occurred; returns NULL if the DLL function execution is successful.

    Description:

    Opens a DLL and returns its handle.

    Parameters:

    Returns:

    Returns the DLL handle if the operation is successful; returns NULL if the operation fails.

    dlsym()

    Description:

    Searches for a specified symbol based on the DLL handle.

    You can also use this function to obtain the loading addresses of global variables.

    Parameters:

    Name

    Description

    handle Indicates the loaded DLL handle.
    symbol Indicates the symbol name.

    Returns the symbol address if the operation is successful; returns NULL if the operation fails.