elf_rand(3E)
elf_rand - Provides random archive member access
As shipped in IRIX 6.5.7. Last changed in IRIX 6.5.5.
NAME elf_rand - Provides random archive member access SYNOPSIS cc [flag ...] file ... -lelf [library ...] #include <libelf.h> size_t elf_rand(Elf *elf, size_t offset); IMPLEMENTATION IRIX systems DESCRIPTION elf_rand, elf_next, and elf_begin manipulate simple object files and archives. elf is an ELF descriptor previously returned from elf_begin. elf_rand provides random archive processing, preparing elf to access an arbitrary archive member. elf must be a descriptor for the archive itself, not a member within the archive. offset gives the byte offset from the beginning of the archive to the archive header of the desired member. See elf_getarsym(3E) for more information about archive member offsets. When elf_rand works, it returns offset. If an error occurred, elf was null, or the file was not an archive (no archive member can have a zero offset), it returns 0. A program may mix random and sequential archive processing. EXAMPLES An archive starts with a ``magic string'' that has SARMAG bytes; the initial archive member follows immediately. An application could provide the following function to rewind an archive (the function returns -1 for errors and 0, otherwise): #include <ar.h> #include <libelf.h> int rewindelf(Elf *elf) { if (elf_rand(elf, (size_t)SARMAG) == SARMAG) return 0; return -1; } SEE ALSO elf(3E), elf_begin(3E), elf_getarsym(3E), elf_next(3E), ar(4) This man page is available only online.