idax-sys
Raw extern "C" FFI bindings to the idax C++ IDA SDK wrapper library, generated by bindgen.
You almost certainly want the idax crate instead, which provides safe, idiomatic Rust wrappers around everything exposed here.
What this crate provides
- 622 FFI function declarations covering 27 IDA SDK domains (database, segments, functions, instructions, types, decompiler, debugger, and more)
- 115 C struct/enum/callback typedefs for data transfer across the FFI boundary
- A C shim layer (
shim/idax_shim.h+shim/idax_shim.cpp) that bridgesextern "C"to the idax C++ API - Automatic bindgen code generation at build time — the output lands in
$OUT_DIR/bindings.rs
Prerequisites
Building this crate requires:
- IDA Pro installed in a standard location (or
$IDADIRset) - CMake and a C++23 compiler
- Rust 2024 edition (nightly or stable 1.85+)
The build script handles everything else automatically: it builds the idax C++ library with CMake, fetches the IDA SDK if $IDASDK is not set, compiles the C shim, runs bindgen, and links everything together.
Installation
[]
= "0.3"
Build environment
No manual setup required. The build script auto-discovers your IDA installation:
$IDADIR— explicit override- macOS:
/Applications/IDA*.app/Contents/MacOS(newest first) - Linux:
/opt/idapro*,/opt/ida-*,/opt/ida,~/ida*
Optional environment variables:
# Override SDK location (otherwise auto-fetched)
# Override IDA runtime location
# Override idax source tree (otherwise auto-cloned)
FFI conventions
The C shim follows consistent conventions documented in shim/idax_shim.h:
| Pattern | Convention |
|---|---|
| Error signaling | Functions returning int: 0 = success, negative = error |
| Error details | Thread-local state via idax_last_error_category() / idax_last_error_code() / idax_last_error_message() |
| String outputs | Returned via char** out-params, malloc'd — free with idax_free_string() |
| Array outputs | Returned via pointer+count out-params, malloc'd — free with free() or the appropriate _free() function |
| Opaque handles | void* (e.g. IdaxTypeHandle) — free with the corresponding idax_type_free() etc. |
| Boolean queries | Return 1 = true, 0 = false (never negative) |
Covered domains
| Domain | C prefix | Functions |
|---|---|---|
| Error handling | idax_last_error_*, idax_free_* |
5 |
| Database | idax_database_* |
28 |
| Address | idax_address_* |
19 |
| Segment | idax_segment_* |
20 |
| Function | idax_function_* |
37 |
| Instruction | idax_instruction_* |
39 |
| Data | idax_data_* |
32 |
| Name | idax_name_* |
16 |
| Cross-references | idax_xref_* |
16 |
| Comment | idax_comment_* |
18 |
| Search | idax_search_* |
8 |
| Analysis | idax_analysis_* |
12 |
| Types | idax_type_* |
44 |
| Entry points | idax_entry_* |
8 |
| Fixups | idax_fixup_* |
12 |
| Events | idax_event_* |
10 |
| Plugin | idax_plugin_* |
12 |
| Loader | idax_loader_* |
12 |
| Debugger | idax_debugger_* |
67 |
| Decompiler | idax_decompiler_* |
32 |
| Storage | idax_storage_* |
14 |
| Lumina | idax_lumina_* |
2 |
| Graph | idax_graph_* |
10 |
| UI | idax_ui_* |
42 |
| Lines | idax_lines_* |
2 |
| Diagnostics | idax_diagnostics_* |
7 |
Architecture
idax-sys (this crate)
|
|-- build.rs
| |-- compiles shim/idax_shim.cpp via `cc`
| |-- runs bindgen on shim/idax_shim.h
| |-- links libidax.a + IDA SDK dylibs
|
|-- src/lib.rs
|-- include!(concat!(env!("OUT_DIR"), "/bindings.rs"))
Linking
The build script links:
libidax.a(static) — the idax C++ wrapperlibida.dylib/libida.so(dynamic) — the IDA SDK runtime- The platform C++ standard library (
libc++on macOS,libstdc++on Linux)
Safety
Everything in this crate is unsafe. Use the idax crate for safe wrappers.
License
MIT