idakit-sys 0.2.0

Raw FFI bindings to IDA Pro's idalib runtime and the idakit C++ facade
Documentation

Raw FFI bindings to IDA's idalib runtime and the idakit C++ facade.

idakit-sys is the unsafe foundation under idakit, which most users want instead: it wraps these bindings in a safe, idiomatic API. Reach here directly only to call a raw symbol the higher layer does not yet expose.

Surface

The declarations are split into per-domain source modules (runtime, bytes, function_flags, instruction, bridge_visitors, ...) that mirror the facade's translation units, but every item is re-exported flat at the crate root, so the public surface is a single namespace (idakit_sys::guarded_open, idakit_sys::CtreeVisitor), not a module hierarchy. Three kinds of item live here:

  • Raw C bindings: extern "C" declarations of the facade's own functions (guarded_open, get_bytes_into, ...) sharing the flat namespace with the idalib/IDA symbols they sit beside (open_database, set_name), plus the #[repr(C)] structs and sentinel constants they exchange.
  • cxx bridges: the spec-generated bridge (from the idakit-sys-codegen engine) and its hand-written companions, returning structured values, owning handles as UniquePtr<T>, or driving a walk through an opaque visitor (CtreeVisitor, TypeWalkVisitor).
  • A typed flag layer: the one deliberate exception to "raw declarations only". OR-able bit masks that also cross as FFI fields become bitflags types (SegmentPermissions, FlowFlags, FrameVarFlags, FlowChartFlags, BinSearchFlags), and closed return-code sets become validated num_enum enums (SigWriteCode, TypeApplyCode); both stay sound at the boundary and spare every caller a hand-rolled bit test. Safe idiomatic wrappers still belong in idakit.

SDK-name aliases

Every binding carries #[doc(alias)] tags for its IDA SDK spelling, so a rustdoc search resolves a name like SEGPERM_READ, FC_NOEXT, or open_database to the binding. Aliases are per crate: idakit_sys carries the raw-binding and SDK names, idakit carries the idiomatic wrappers.

Buffer conventions

Functions that accept (*mut c_char, cap: usize) copy the value into the caller-supplied buffer and NUL-terminate within cap bytes. The return value is the full source length, which may exceed cap when the output was truncated. A negative return value means the query failed (missing symbol, null handle, etc.).

Owned handles

Opaque owned handles cross as cxx UniquePtr<T> (CompiledBinpat, CFunc, TInfo), freed by cxx's deleter on drop. Any handle still passed as a raw *mut c_void is paired with an explicit dispose call; using one after disposal is undefined behaviour.

License

MIT. The IDA SDK and runtime are proprietary to Hex-Rays; these bindings link against your own install and redistribute none of it.