Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ldopen(3) [osf1 man page]

ldopen(3)						     Library Functions Manual							 ldopen(3)

NAME
ldopen, ldaopen - open a common object file for reading LIBRARY
libmld.a SYNOPSIS
#include <stdio.h> #include <filehdr.h> #include <syms.h> #include <ldfcn.h> LDFILE *ldopen (filename, ldptr) char *filename; LDFILE *ldptr; LDFILE *ldaopen (filename, oldptr) char *filename; LDFILE *oldptr; ldreadst (ldptr, flags) LDFILE *ldptr; int flags; DESCRIPTION
The ldopen and ldclose(3) routines provide uniform access to simple object files and to object files that are members of archive files. An archive of common object files can be processed as if it were a series of simple common object files. If ldptr has the value NULL, ldopen opens filename, allocates and initializes the LDFILE structure, and returns a pointer to the structure to the calling program. If ldptr is valid and TYPE(ldptr) is the archive magic number, ldopen reinitializes the LDFILE structure for the next archive member of filename. ldopen and ldclose work in concert. ldclose returns FAILURE only when TYPE(ldptr) is the archive magic number and there is another file in the archive to be processed. Only then should ldopen be called with the current value of ldptr. In all other cases, and particularly when a new filename is opened, ldopen should be called with a NULL ldptr argument. The following is a prototype for the use of ldopen and ldclose: /* for each filename to be processed */ ldptr = NULL; do if ( (ldptr = ldopen(filename, ldptr)) != NULL ) { /* check magic number */ /* process the file */ } } while (ldclose(ldptr) == FAILURE ); If the value of oldptr is not NULL, ldaopen opens filename anew and allocates and initializes a new LDFILE structure, copying the fields from oldptr. ldaopen returns a pointer to the new LDFILE structure. This new pointer is independent of the old pointer, oldptr. The two pointers can be used concurrently to read separate parts of the object file. For example, one pointer can be used to step sequentially through the relocation information while the other is used to read indexed symbol table entries. The ldopen function and ldaopen open filename for reading. If filename cannot be opened or if memory for the LDFILE structure cannot be allocated, both functions return NULL. A successful open does not ensure that the given file is a common object file or an archived object file. The ldopen function causes the symbol table header and file descriptor table to be read. Further access, using ldptr, causes other appro- priate sections of the symbol table to be read (for example, if you call ldtbread, the symbols or externals are read). To force sections for the symbol table in memory, call ldreadst with ST_P* constants ORed together from st_support.h. The program must be loaded with the object file access routine library libmld.a. RELATED INFORMATION
fopen(3), ldclose(3), ldfcn(4). delim off ldopen(3)

Check Out this Related Man Page

stio(3) 						     Library Functions Manual							   stio(3)

NAME
stio - Routines that provide a binary read/write interface to the symbol table SYNOPSIS
#include <syms.h> long st_readbinary (filename, how) char *filename; char how; long st_readst (fn, how, filebase, pchdr, flags) long fn; char how; long filebase; pCHDRR pchdr; long flags; void st_writebinary (filename, flags) char *filename; long flags; void st_writest (fn, flags) long fn; long flags; DESCRIPTION
The CHDRR structure (see stcu(3)) represents a symbol table in memory. A new CHDRR can be created by reading a symbol table in from disk. The St_readbinary and st_readst routines read a symbol table in from disk. The St_readbinary routine takes the file name of the symbol table and assumes the symbol table header HDRR occurs at the beginning of the file. The St_readst routine assumes that its file number references a file positioned at the beginning of the symbol table header and that the filebase parameter specifies where the object or symbol table file is based (for example, non-zero for archives). The second parameter to the read routines can be `r' for read only or `a' for appending to the symbol table. Existing local symbol, line, procedure, auxiliary, optimization, and local string tables can not be appended. If they did not exist on disk, they can be created. This restriction stems from the allocation algorithm for those symbol table sections when read in from disk and follows the standard pattern for building the symbol table. The symbol table can be read incrementally. If pchdr is zero, st_readst assumes that no symbol table has been read yet; therefore, it reads in the symbol table header and file descriptors. The flags argument is a bit mask that defines what other tables should be read. St_p* constants for each table can be ORed. If flags equals `-1', all tables are read. If pchdr is set, the tables specified by flags are added to the tables that have already been read. The value of pchdr can be gotten from st_current_pchdr (see stcu(3)). Line number entries are encoded on disk, and the read routines expand them to longs. If the version stamp is out of date, a warning message is issued to stderr. If the magic number in the HDRR is incorrect, st_error is called. All other errors cause the read routines to read non-zero; otherwise, a zero is returned. The St_writebinary and st_writest routines are symmetric to the read routines, excluding the how and pchdr parameters. The flags parameter is a bit mask that defines what table should be written. St_p* constants for each table can be ORed. If flags equals `-1', all tables are written. The write routines write sections of the table in the approved order, as specified in the link editor (ld) specification. Line numbers are compressed on disk. The write routines start all sections of the symbol table on four-byte boundaries. If the write routines encounter an error, st_error is called. After writing the symbol table, further access to the table by other routines is undefined. RELATED INFORMATION
stcu(3), stfe(3), stfd(3) delim off stio(3)
Man Page