cbindgen
cbindgen copied to clipboard
Correctly parsing c variadics `args: ...`
I was looking at how cbindgen is parsing c variadic arguments here. Would it be possible to make it c variadic instead of VaList? For instance this function
func(stream: *mut FILE, fmt: *const c_char, mut args: ...)
Would be exported to a header as
func(FILE * stream, const char * fmt, ...)
+1 it was broken by #805
I'd like to generate a definition that is compatible with an existing C definition which uses the ... syntax.
Note: in 0.24.5 it somehow worked because cbindgen outputs ... for function pointers
Example
#[no_mangle]
pub extern "C" fn chewing_set_logger(
ctx: *mut ChewingContext,
logger: extern "C" fn(data: *mut c_void, level: c_int, fmt: *const c_char, arg: ...),
data: *mut c_void,
) {}
used to output
void chewing_set_logger(ChewingContext *ctx,
void (*logger) (void *data, int level, const char *fmt, ...), void *data);