retrieve uninterpreted file contents
cc [flag . . . ] file . . . -lelf [library] . . .
char elf_rawfile(Elf elf, size_t ptr);
returns a pointer to an uninterpreted byte image of the file.
This function should be used only to retrieve a file being read.
For example, a program might use
to retrieve the bytes for an archive member.
may not close or disable [see
the file descriptor associated with
before the initial call to
might have to read the data from the file if it does not
already have the original bytes in memory.
Generally, this function is more efficient for unknown
file types than for object files.
The library implicitly translates object files in memory,
while it leaves unknown files unmodified.
Thus asking for the uninterpreted image of an object file
may create a duplicate copy in memory.
is a related function, providing access to sections
within a file.
is non-null, the library also stores the file's size, in bytes,
in the location to which
If no data is present,
is null, or an error occurs, the return value is a null pointer,
with zero optionally stored through
A program that uses
and that also interprets the same file as an object file
potentially has two copies of the bytes in memory.
If such a program requests the raw image first,
before it asks for translated information
(through such functions as
and so on), the library ``freezes'' its original memory
copy for the raw image.
It then uses this frozen copy as the source for creating
translated objects, without reading the file again.
Consequently, the application should view the raw file
image returned by
as a read-only buffer, unless it wants to alter its
own view of data subsequently translated.
In any case, the application may alter the translated
objects without changing bytes visible in the raw image.
Multiple calls to
with the same
descriptor return the same value;
the library does not create duplicate copies of the file.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004