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

Opaque type for Mutex #930

Open
ultimaweapon opened this issue Feb 23, 2024 · 3 comments
Open

Opaque type for Mutex #930

ultimaweapon opened this issue Feb 23, 2024 · 3 comments

Comments

@ultimaweapon
Copy link

Is it possible for cbindgen to automatically generate an opaque type for Mutex for this function?

#[no_mangle]
pub unsafe extern "C-unwind" fn foo(bar: *const Mutex<Bar>) {}

What I got from this is something like without opaque type for Mutex:

struct Bar;

void foo(const Mutex<Bar> *bar);
@ultimaweapon
Copy link
Author

I need something like this but don't know how to configure the cbindgen::Builder to achieve this result.

@emilio
Copy link
Collaborator

emilio commented Apr 14, 2024

Send a patch adding it to Parse::add_std_types to get what you want. Alternatively, add the raw forward declaration using one of the other config options?

@ultimaweapon
Copy link
Author

Thank you for the response. I'll send a patch when I have time to work on this.

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

No branches or pull requests

2 participants