rust-lang / rust-lang/rust-bindgen

Better docs or features for intermediate-complexity use cases (nested headers)

Open
#454 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm following the instructions for using libbindgen in build.rs, and I'm trying to generate bindings for a c library that uses glib. This example doesn't seem to quite meet my needs because glib headers assume an include path for headers they then include, and adding the subheaders to my wrapper.h I think it thinks #include <glib-2.0/glib/gmacros.h> is different from glib/gmacros.h. Or anyways, it's not working. glib assumes users just include the top-level glib.h.

Then I can look at Servo's use of bindgen for Stylo, and how it's recursively finding includes, but it's also doing a lot of other stuff so "just make bindgen handle includes recursively" isn't easy to extract from that for my project. Nested includes and include paths are something that almost every C lib that has more than one header does, so more docs or moving this capability into base bindgen would help a lot, I think.

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

Start with the libbindgen instructions used from build.rs and the wrapper.h setup described in the issue. Compare them with Servo's Stylo bindgen usage, then define whether the result should document or support recursive nested includes and include paths for glib-like headers; done means the intended approach is clear and works for that use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, 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.