Skip to content

Properly implement extensions #2288

Open
@bobbbay

Description

@bobbbay

Input C/C++ Header

class Gyro {
 public:
  virtual void Calibrate() = 0;
};

class SomeGyro : public Gyro {
 public:
  void Calibrate() final;
};

Bindgen Invocation

$ bindgen test.hpp

Actual Results

/* automatically generated by rust-bindgen 0.59.2 */

#[repr(C)]
pub struct Gyro__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Gyro {
    pub vtable_: *const Gyro__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_Gyro() {
    assert_eq!(
        ::std::mem::size_of::<Gyro>(),
        8usize,
        concat!("Size of: ", stringify!(Gyro))
    );
    assert_eq!(
        ::std::mem::align_of::<Gyro>(),
        8usize,
        concat!("Alignment of ", stringify!(Gyro))
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SomeGyro {
    pub _base: Gyro,
}
#[test]
fn bindgen_test_layout_SomeGyro() {
    assert_eq!(
        ::std::mem::size_of::<SomeGyro>(),
        8usize,
        concat!("Size of: ", stringify!(SomeGyro))
    );
    assert_eq!(
        ::std::mem::align_of::<SomeGyro>(),
        8usize,
        concat!("Alignment of ", stringify!(SomeGyro))
    );
}
extern "C" {
    #[link_name = "\u{1}_ZN8SomeGyro9CalibrateEv"]
    pub fn SomeGyro_Calibrate(this: *mut ::std::os::raw::c_void);
}

Expected Results

An implementation of SomeGyro::Calibrate, instead of SomeGyro_Calibrate. Frankly, I'm not sure how I would get my hands on a *mut os::raw::c_void that points to a SomeGyro on the Rust side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions