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


Initializing Dld

The function dld_init must be called before any other dld functions.

Function: int dld_init (const char *progname)
where path is the name of the currently running program, as given by argv[0].

This function initializes internal data structures of dld and loads into memory symbol definitions of the executing process. By doing so, other dynamically loaded functions can reference symbols already defined or share functions already exist in the executing process.

dld_init returns 0 when successful; otherwise, it returns an error code that is non-zero (see section Definition of Error Codes).

Locating the Executable File

The path name of the executing process as required by dld_init might not be easily obtained all the time. Not all systems pass the entire path name of the executable file as the first argument (argv[0]) to main. In order to obtain the full path of the executable file, dld_init uses the dld_find_program function.

Function: char *dld_find_progname (const char *progname)
dld_find_progname returns the absolute path name of the file that would be executed if command were given as a command. It looks up the environment variable PATH, searches in each of the directory listed for progname, and returns the absolute path name for the first occurrence.

Note: If the current process is executed using the execve call without passing the correct path name as argument 0, dld_find_program (argv[0]) will also fail to locate the executable file.

dld_find_executable returns zero if command is not found in any of the directories listed in PATH.


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