Skip to content

bindgen & LLVM 18 support for Rust #5390

@yujack008

Description

@yujack008

I getting start with https://rust.binary.ninja/binaryninja/index.html#writing-a-plugin
My rustc version is rustc 1.77.0 (aedd173a2 2024-03-17)
My LIBCLANG_PATH is "E:\clang+llvm-18.1.5-x86_64-pc-windows-msvc\bin"
step:
1.cargo new --lib deobf
2.edit Cargo.toml

[lib]
crate-type = ["cdylib"]

[dependencies]
binaryninja = {git = "https://github.com/Vector35/binaryninja-api.git", branch = "dev"}

3.cargo build

then get so much error!

error[E0425]: cannot find function, tuple struct or tuple variant `BNFreeQualifiedNameTypeAndId` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2489:13
     |
2470 | pub struct QualifiedNameTypeAndId(pub(crate) BNQualifiedNameTypeAndId);
     | ----------------------------------------------------------------------- similarly named tuple struct `QualifiedNameTypeAndId` defined here
...
2489 |             BNFreeQualifiedNameTypeAndId(&mut self.0);
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple struct with a similar name exists: `QualifiedNameTypeAndId`

error[E0425]: cannot find function, tuple struct or tuple variant `BNFreeTypeIdList` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2500:9
     |
2500 |         BNFreeTypeIdList(raw, count);
     |         ^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `BNAllocString` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2527:23
     |
2527 |                 name: BNAllocString(name.into_bytes_with_nul().as_ref().as_ptr() as *mut _),
     |                       ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `BNFreeString` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2567:13
     |
     |             ^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `BNFreeNameAndTypeList` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2580:9
     |
2580 |         BNFreeNameAndTypeList(raw, count);
     |         ^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `BNFreeType` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2649:18
     |
2649 |         unsafe { BNFreeType(handle.0.type_) }
     |                  ^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `BNFreeDataVariables` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2659:9
     |
2659 |         BNFreeDataVariables(raw, count);
     |         ^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `BNGetArchitectureIntrinsicName` in this scope
    --> D:\Projects\Rust\binaryninja-api\rust\src\types.rs:2722:33
     |
2722 |         let name_ptr = unsafe { BNGetArchitectureIntrinsicName(self.arch.0, self.index) };
     |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

Metadata

Metadata

Assignees

Labels

Component: Rust APIIssue needs changes to the Rust APIEffort: LowIssues require < 1 week of workImpact: HighIssue adds or blocks important functionality

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions