rust-lang / rust-lang/rust-bindgen

Is there a way to gen func type from c/cpp func declaration

Open
#2,705 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

Input C/C++ Header
extern void add(int a, int b);

now i got:

extern "C" {
    pub fn add(a: i32, b:i32);
}

i also want:

type Tadd = unsafe extern "C" fn(i32,i32);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Clarify the desired bindgen configuration or output behavior, then verify that the C declaration produces a reusable Rust unsafe extern function-pointer type.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.