MachOUniversalBinaryFile

public final class MachOUniversalBinaryFile : BinaryFile

An in-memory representation of a Mach-O universal binary file.

  • Creates an MachOUniversalBinaryFile with the contents of the object file at the provided path.

    Throws

    MemoryBufferError or BinaryFileError if there was an error on creation

    Declaration

    Swift

    public convenience init(path: String) throws

    Parameters

    path

    The absolute file path on your filesystem.

  • Creates a Mach-O universal binary file with the contents of a provided memory buffer.

    Throws

    BinaryFileError if there was an error on creation.

    Declaration

    Swift

    public override init(memoryBuffer: MemoryBuffer, in context: Context = .global) throws

    Parameters

    memoryBuffer

    A memory buffer containing a valid universal Mach-O file.

    context

    The context to allocate the given binary in.

  • Retrieves the object file for a specific architecture, if it exists.

    Throws

    BinaryFileError if there was an error on creation.

    Declaration

    Swift

    public func objectFile(for architecture: Triple.Architecture) throws -> Slice

    Parameters

    architecture

    The architecture of a Mach-O file contained in this universal binary file.

    Return Value

    An object file for the given architecture if it exists.

  • Represents an architecture-specific slice of a Mach-O universal binary file.

    Declaration

    Swift

    public final class Slice : ObjectFile