Project

General

Profile

Actions

Task #7341

open

rust: use bindgen to generate Rust bindings to C functions

Added by Jason Ish about 1 month ago. Updated about 1 month ago.

Status:
Assigned
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

Currently, we write out our own Rust bindings to C functions; however, a tool such as bindgen could do this for us. This tool would automatically update the bindings when a change was made to C, minimizing possible issues resulting from one side being updated and not the other.

One issue we currently have is C functions called from Rust, containing a type defined in Rust with C bindings generated with cbindgen. This creates a circular dependency I don't think we can tool ourselves out of.

One rule to follow that could prevent this is if a function is defined in C, all types in its signature must also be defined in C, unless they can be expressed as an opaque type. Currently, we export some Rust structs/enums to C that are not opaque, which is probably the main source of these circular dependencies.

Actions

Also available in: Atom PDF