-
Notifications
You must be signed in to change notification settings - Fork 356
Description
I wonder if it is possible to add an annotation for functions to customize the return type of a function, something like this:
/// cbindgen:return-type=Foobar
pub extern "C" fn foobar() -> Foobar<abc>;Some background: we are trying to use cbindgen to generate some code that will be compiled with MSVC toolchain. cbindgen will generate template for Rust generics. This worked well with clang and gcc but not MSVC. So we decided to manually define the generic type with some void pointer and manually casting it to the concrete type (the only generic in the Rust struct is a pointer so we can do this). However, cbindgen will still generate the return type for functions with template parameter which we do not want. So I think it would be nice if cbindgen allows us to customize it with some annotations.
I understand this is not a very reasonable feature request, and I don't think many people would be in a situation like this. Please let me know what do you think. I can work on adding this feature if you guys think it's okay.
Thanks!