65 lines
955 B
Rust
Raw Normal View History

2017-08-17 20:06:33 -04:00
#[cfg(all(unix, x11))]
#[repr(u32)]
enum FooType {
A,
B,
C,
}
#[cfg(all(unix, x11))]
#[repr(C)]
struct FooHandle {
ty: FooType,
x: i32,
y: f32,
}
#[cfg(any(windows, target_pointer_width="32"))]
#[repr(u32)]
enum BarType {
A,
B,
C,
}
2020-02-01 21:17:26 +01:00
#[repr(u8)]
pub enum C {
C1,
C2,
#[cfg(windows)]
C3,
#[cfg(unix)]
C5 { int: i32 },
}
2017-08-17 20:06:33 -04:00
#[cfg(any(windows, target_pointer_width="32"))]
#[repr(C)]
struct BarHandle {
ty: BarType,
x: i32,
y: f32,
}
2019-04-08 14:24:52 +02:00
// FIXME(#634): Support deriving methods for structs with conditional fields.
/// cbindgen:derive-eq=false
/// cbindgen:derive-neq=false
#[repr(C)]
struct ConditionalField {
#[cfg(x11)]
field: i32,
}
2017-08-17 20:06:33 -04:00
#[cfg(all(unix, x11))]
#[no_mangle]
2020-02-01 21:17:26 +01:00
pub extern "C" fn root(a: FooHandle, c: C)
2017-08-17 20:06:33 -04:00
{ }
#[cfg(any(windows, target_pointer_width="32"))]
#[no_mangle]
2020-02-01 21:17:26 +01:00
pub extern "C" fn root(a: BarHandle, c: C)
2017-08-17 20:06:33 -04:00
{ }
2019-04-08 14:24:52 +02:00
#[no_mangle]
pub extern "C" fn cond(a: ConditionalField)
{ }