Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf_rand(3E) — Amiga System V Release 4 Version 1.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)

ar(4)



elf_rand(3E)      MISC. REFERENCE MANUAL PAGES       elf_rand(3E)



NAME
     elfrand - random archive member access

SYNOPSIS
     cc [flag ...] file ...  -lelf [library ...]

     #include <libelf.h>

     sizet elfrand(Elf *elf, sizet offset);

DESCRIPTION
     elfrand, elfnext, and elfbegin manipulate  simple  object
     files  and  archives.   elf  is an ELF descriptor previously
     returned from elfbegin.  elfrand 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 elfgetarsym(3E) for more
     information about archive  member  offsets.   When  elfrand
     works,  it  returns offset.  Otherwise it returns 0, because
     an error occurred, elf was null, or  the  file  was  not  an
     archive  (no archive member can have a zero offset).  A pro-
     gram may mix random and sequential archive processing.

EXAMPLE
     An archive starts with a ``magic string''  that  has  SARMAG
     bytes;  the  initial archive member follows immediately.  An
     application could thus 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 (elfrand(elf, (sizet)SARMAG) == SARMAG)
                          return 0;
                  return -1;
          }

SEE ALSO
     elf(3E), elfbegin(3E), elfgetarsym(3E), elfnext(3E),
     ar(4).










                    Last change: ELF Library                    1



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026