Expand description
§idalib
idalib is a Rust library providing idiomatic bindings for the IDA SDK, enabling the development of standalone analysis tools using IDA v9.0’s idalib.
§Usage
To use idalib, add it as a dependency in your Cargo.toml
and include a build.rs
file in
your project to properly link against IDA:
[dependencies]
idalib = "0.4"
[build-dependencies]
idalib-build = "0.4"
Here is a basic example of a build.rs
file:
fn main() -> Result<(), Box<dyn std::error::Error>> {
idalib_build::configure_linkage()?;
Ok(())
}
This script uses the idalib-build
crate to automatically configure the linkage against IDA.
Ensure that the environment variables IDASDKDIR
and optionally IDADIR
are set to point to
your IDA SDK and installation directories, respectively.
§Setting Environment Variables
§On Linux/macOS
You can set the environment variables in your terminal session or add them to your shell
configuration file (e.g., .bashrc
, .zshrc
):
export IDASDKDIR=/path/to/ida/sdk
export IDADIR=/path/to/ida/installation
§On Windows
Set environment variables using Command Prompt, PowerShell, or System Properties.
Command Prompt:
set IDASDKDIR=C:\path\to\ida\sdk
set IDADIR=C:\path\to\ida\installation
PowerShell:
$env:IDASDKDIR = "C:\path\to\ida\sdk"
$env:IDADIR = "C:\path\to\ida\installation"
System Properties:
Go to “Environment Variables” in System Properties and add IDASDKDIR
and IDADIR
.
§Example
Here’s a simple example of how to use idalib:
use idalib::idb::IDB;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let idb = IDB::open("/path/to/binary")?;
// Perform analysis...
Ok(())
}
Re-exports§
pub use license::is_valid_license;
pub use license::license_id;
pub use license::LicenseId;
pub use idalib_sys as ffi;