Example library:
use std::boxed::Box;
#[repr(C)]
pub struct S {
x: *const ()
}
#[no_mangle]
pub extern "C" fn f() -> S {
let s = Box::new(());
unsafe { std::mem::transmute(s) }
}
output of cbindgen --lang c:
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct S S;
struct S f(void);
cbindgen was unable to generate struct S, presumably because it doesn't know what to make of *const (). Perhaps should be translated to C as a void const * ?