LDGETARNAME(3X) Domain/OS SysV LDGETARNAME(3X)
NAME
ldgetarname - retrieve the filename of a member of an archive file
SYNOPSIS
#include <stdio.h>
#include <filehdr.h>
#include <ldfcn.h>
#include <ar.h>
char *ldgetarname (ldptr)
LDFILE *ldptr;
DESCRIPTION
If TYPE(ldptr) is the archive file magic number, ldgetarname returns a
pointer to the name of the common object file currently associated with
ldptr as a string. The string is contained in a static buffer local to
ldgetarname that is overwritten by each call to ldgetarname, and
therefore must be copied by the caller if the name is to be saved.
ldgetarname can be used to retrieve names from archive files without any
backward compatibility problems. If the archive does not contain a
filename table, ldgetarname will return the name stored in the archive
header. ldgetarname will return NULL (defined in <stdio.h>) for an
archive file if the name cannot be retrieved. This situation can occur
if:
⊕ TYPE(ldptr) does not represent an archive file,
⊕ the archive headers cannot be read,
⊕ not enough memory can be allocated for the filename table,
Typically, ldgetarname will be called immediately after a successful call
to ldahread to retrieve the name associated with the archive header
filled by ldahread.
The program must be loaded with the object file access routine library
libld.a.
SEE ALSO
ldclose(3X), ldopen(3X), ldahread(3X), ldfcn(4), ar(4).