Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly parsing c variadics args: ... #891

Open
darleybarreto opened this issue Oct 13, 2023 · 1 comment · May be fixed by #894
Open

Correctly parsing c variadics args: ... #891

darleybarreto opened this issue Oct 13, 2023 · 1 comment · May be fixed by #894

Comments

@darleybarreto
Copy link

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, ...)
@4lDO2 4lDO2 linked a pull request Oct 29, 2023 that will close this issue
@kanru
Copy link

kanru commented Dec 31, 2023

+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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants