Query: ldfcn
OS: ultrix
Section: 5
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
ldfcn(5) File Formats Manual ldfcn(5) Name ldfcn - common object file access routines Syntax #include <stdio.h> #include <filehdr.h> #include <syms.h> #include <ldfcn.h> Description The common object file access routines are a collection of functions that read an object file that is in common object file form. The calling program must know the detailed structure of the parts of the object file that it processes, but the calling program does not have to know the overall structure of the object file as the routines handle this function. The interface between the calling program and the object file access routines is based on the defined type (defined as which is declared in the header file Primarily, this structure provides uniform access to simple object files and object files that are members of an archive file. The function allocates and initializes the structure, reads in the symbol table header, if present, and returns a pointer to the structure to the calling program. The fields of the structure can be accessed individually through macros defined in The fields contain the follow- ing information: LDFILE *ldptr; TYPE(ldptr) The file magic number, used to distinguish between archive members and simple object files. IOPTR(ldptr) The file pointer returned by and used by the standard input/output functions. OFFSET(ldptr) The file address of the beginning of the object file; if the object file is a member of an archive file, the offset is nonzero. HEADER(ldptr) The file header structure of the object file. SYMHEADER(ldptr) The symbolic header structure for the symbol table associated with the object file. PFD(ldptr) The file table associated with the symbol table. SYMTAB(ldptr) A pointer to a copy of the symbol table in memory. It is accessed through the pCHDR structure (see If no symbol table is present, this field is NULL. This macro causes the whole symbol table to be read. LDSWAP(ldptr) If the header and symbol table structures are swapped within the object file and all access requires using this field is set to true. Note that if you use routines, all structures, except the optional header and auxiliaries, are swapped. The object file access functions can be divided into four categories:(1) Functions that open or close an object file and open a common object file and close a common object file(2) Functions that return header or symbol table information read the archive header of a member of an archive file read the file header of a common object file and read a section header of a common object file read a symbol table entry of a common object file retrieve a symbol name from a symbol table entry or from the string table retrieve a pointer into the aux table for the specified ldptr create a type string (for example, C declarations) for the specified symbol retrieve a procedure descriptor retrieve a relative file table entry(3) Functions that position (seek to) an object file at the start of the section, relocation, or line number information for a par- ticular section seek to the optional file header of a common object file and seek to a section of a common object file and seek to the relocation information for a section of a common object file and seek to the line number information for a section of a common object file seek to the symbol table of a common object file(4) Miscellaneous functions return the index of a particular common object file symbol table entry initialize the tables and constants so that the archive hash and lookup routines can work give a string return the hash index for it return an archive hash bucket that is empty or matches the string argument print MIPS assembly instructions cause a section of the symbol table to be read These functions are described in detail in the manual pages identified for each function. The and functions both return pointers to a structure. Macros Additional access to an object file is provided through a set of macros defined in These macros parallel the standard inputoutput file reading and manipulating functions. They translate a reference of the structure into a reference to its file descriptor field. The following macros are provided: GETC(ldptr) FGETC(ldptr) GETW(ldptr) UNGETC(c, ldptr) FGETS(s, n, ldptr) FREADM((char *) ptr, sizeof (*ptr), nitems, ldptr) FSEEK(ldptr, offset, ptrname) FTELL(ldptr) REWIND(ldptr) FEOF(ldptr) FERROR(ldptr) FILENO(ldptr) SETBUF(ldptr, buf) STROFFSET(ldptr) The STROFFSET macro calculates the address of the local symbol's string table in an object file. See the manual entries for the corre- sponding standard input/output library functions for details on the use of these macros. (The functions are identified as 3s in Section 3 of the reference pages.) Restrictions The macro defined in the header file translates into a call to the standard input/output function should not be used to seek from the end of an archive file since the end of an archive file cannot be the same as the end of one of its object file members. See Also ar(1), fopen(3s), fseek(3s), ldahread(3x), ldclose(3x), ldfhread(3x), ldgetname(3x), ldlread(3x), ldlseek(3x), ldohseek(3x), ldopen(3x), ldrseek(3x), ldlseek(3x), ldshread(3x), ldtbindex(3x), ldtbread(3x), ldtbseek(3x) RISC ldfcn(5)
Similar Topics in the Unix Linux Community |
---|
Get the positional value from first line of the file |