-
Notifications
You must be signed in to change notification settings - Fork 314
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
Support C# and/or expose intermediate representation? #846
Comments
Hi there ! I have a project where I'm exposing a rust lib to java/kotlin using JNA, and I'm toying with the idea of adding support inside cbindgen as well. From what I see in the current code, the swich between the various supported languages is done via Adding a proper backend abstraction seems the way to go especially if we add C# and Java as supported language, maybe a trait with default impls called at relevant places in the What do you think @emilio, is even adding support for new languages something you would consider ? I'm happy to do this refactoring and adding java support if you're OK with it |
Yeah, I'd say a general back-end abstraction (probably an initial refactor would be to add |
And here is #857 that contains the java backend, can be some inspiration to add the C# one |
@fredszaq @yanchith Is somebody else working on the C# backend or are you looking for contributers? I'd be happy to give it a crack if you liked. I'm a bit of a Rust novice, but know C# and it's interop stuff very well. I think I'd be able to do it but don't want to jump the gun if somebody else has already made progress on it or the language backend is too unstable for now. |
Hi @Tacodiva I have no plans to work on the C# backend (I don't know the language). If you use the work in #853 adding a new language should be pretty straightforward if you're familiar with the language ffi :P By the way ping @emilio I would love to see #853 merged at some point (as well as #857) please tell me if there is anything I can do to make this happen. I understand it is quite a big change and could take some time to review, but it seems like adding new languages support to cbindgen is a hot subject these days (see #867 as well) and it would greatly facilitate this ! |
@ZhaoXiangXML I am not currently working on it, I have moved onto other things. Eventually I might circle back around to it and when/if I do I'll open a PR here straight away to indicate I am working on it, but for now I am not. |
@ZhaoXiangXML Neither am I. Feel free to take it, if you are feeling the initiative. |
Well in that case I'll see if I can do it myself. Thanks. |
We have a project, where we generate both C and C# bindings for a Rust library. The API is very C-like, and we take care not to use any fancy features in it.
C# bindings are currently generated for us by csbindgen, which is not on par with cbindgen feature-wise (and its authors don't seem like they want it to be). We thus have to employ a lot of hacks to make it work.
cbindgen, on the other hand already supports most of what we need. Is either adding a new C# backend to cbindgen or exposing the intermediate representation so that people can write their own backends possible and desirable?
We might have to do this anyway, but we'll gladly contribute back.
The text was updated successfully, but these errors were encountered: