openElf

fnElfFile openElf(string path)

Open an ELF file from disk.

Parameters

pathPath to the ELF file.

Returns

An ElfFile instance for reading the file.

Throws

Exception if the file cannot be read or is not a valid ELF file.
fnElfFile openElf(const(ubyte)[] data)

Open an ELF file from a byte array.

Note

The returned ElfFile holds a reference to the provided data array.

The caller must ensure the data array remains valid for the lifetime of the ElfFile. If the data may be freed or go out of scope, use openElf(string path) instead, or duplicate the data before passing it:

auto file = openElf(data.dup);

Parameters

dataThe ELF file data as a byte array.

Returns

An ElfFile instance for reading the file.

Throws

Exception if the data is not a valid ELF file.