AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

�� · ·. � ·

LDOPEN{3X) LDOPEN { 3X) NAME ldopen, ldaopen - open a common object file for reading SYNOPSIS #include #include #include LDFILE •ldopen (filename, ldptr) char •filename; LDFILE •ldptr; LDFILE •ldaopen (filename, oldptr) char •filename; LDFILE *oldptr; DESCRIPTION Ldopen and ldclose(3X) are designed to provide uniform access to both simple object files and object files that are members of archive files. Thus 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, then ldopen will open filename and allocate and initialize the LDFILE structure, and return a pointer to the structure to the calling program. If ldptr is valid and if TYPE(ldptr) is the archive magic number, ldopen will reinitialize the LDFILE structure for the next archive member of filename . Ldopen and ldclose are designed to work in concert. Ldclose will return 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, in particular whenever 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 . I* for each filename to be processed •I ldptr = NULL; do if ( (ldptr = ldopen(filename, ldptr)) != NULL ) { I* check magic number •/ I• process the file •/ } while 0dclose(ldptr) == FAILURE ); If the value of oldptr is not NULL, ldaopen will open filename anew and allocate and initialize a new LDFILE structure, copying the TYPE, OFFSET, and HEADER 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 may be used concurrently to read separate parts of the object file. For - 1 -

�� · ·.<br />

�<br />

·

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!