Page
Library
Module
Module type
Parameter
Class
Class type
Source
objectThe object package provides a unified interface for working with object files across platforms. It supports reading relocatable object files and executable files, and writing COFF/ELF/Mach-O/XCOFF relocatable object files and ELF/PE/Mach-O executable files.
For reading files the library provides various abstraction levels:
Supported file formats for reading: ELF, Mach-O, and PE/COFF.
For writing files the library provides:
To install object as a dependency, run:
$ opam install objectAnd add object to your project's dune-project or *.opam files.
The tests for object are split between:
test/unit that build in-memory representations of binaries and test they can be parsed correctly. They can be run using dune build @runtest.test/integration that use the system toolchain to build binaries and check they can be parsed correctly. These tests rely more on specific versions of the toolchain that match GitHub CI runners. They can be run using dune build @integration.Both suites can be run together with dune build @run-all-tests.
Example programs in example directory
This motivation for this library grew out of the author's need to manipulate object files and DWARF information while working on the OCaml compiler. The library name simultaneously derives from the author's fascination with objects in OCaml and the Rust library of the same name.
The PE/COFF support was informed by these existing OCaml parsers: