mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.37k stars 306 forks source link

Introduce language backend #853

Closed fredszaq closed 5 months ago

fredszaq commented 1 year ago

As discussed in #846 this introduces the notion of language backend in order to facilitate the addition of new supported languages to cbindgen

Notable changes:

All tests continue to pass without any modification \o/ (those were quite useful during the refacto)

yanchith commented 1 year ago

I am not familiar with the codebase, so I can't really review the patch itself. However, looking at clike.rs and cython.rs, this would give me a solid form to fill out to add the C# backend I need. Looking forward 👍

fredszaq commented 1 year ago

@emilio Did you have time to take a look ? I'm planning to work on the java-jna backend this week, would be nice to have a confirmation we want to go in this direction ;)

emilio commented 1 year ago

Sorry for the lag getting to this btw :/

fredszaq commented 1 year ago

Thanks for the review ! I think I tried the write_xxx functions in the language backend trait first but was blocked by something. I cannot remember what though. I'll take a look when I'm back from holidays in september

fredszaq commented 1 year ago

Hi @emilio ! I just rebased the branch and did the changes you asked, this effectively removes the source trait.

ZhaoXiangXML commented 8 months ago

Hello, is this MR going to be merged?

fredszaq commented 8 months ago

Ping @emilio, I would love to see this merged (and #857) as well. Please tell be what I can do to facilitate this. All the remarks that have been raised till now have been addressed and I'll be pleased to make any other change deemed necessary.

kang-sw commented 8 months ago

Oh Wow, this was exactly what I was looking for and trying to implement on my own from this night. God thanks I tried searching 'dynamic' on issue list and found this. Great appreciation for your effort and wish it'd be merged onto mainstream as soon as possible, thanks!