www.delorie.com/gnu/docs/dld/dld_6.html   search  
Buy GNU books!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Dynamically Linking in New Modules

The function dld_link dynamically links in the named relocatable object or library file into memory.

Function: int dld_link (const char *filename)
where filename is the path name of the file to be linked. Specifically, if the named file is a relocatable object file, it is completely loaded into memory. If it is a library file, only those modules defining an unresolved external reference are loaded. Since a module in the library may itself reference other routines in the library, loading it may generate more unresolved external references. Therefore, a library file is searched repeatedly until a scan through all library members is made without having to load any new modules.

Storage for the text and data of the dynamically linked modules is allocated using malloc. In other words, they are kept in the heap of the executing process.

After all modules are loaded, dld_link resolves as many external references as possible. Note that some symbols might still be undefined at this stage, because the modules defining them have not yet been loaded.

If the specified module is linked successfully, dld_link returns 0; otherwise, it returns a non-zero error code (see section Definition of Error Codes).

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003