Closed fredszaq closed 5 months 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 👍
@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 ;)
Sorry for the lag getting to this btw :/
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
Hi @emilio ! I just rebased the branch and did the changes you asked, this effectively removes the source trait.
Hello, is this MR going to be merged?
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.
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!
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:
LanguageBackend
trait containing functions to write headers and footers in a source fileLanguageBackend
impls :CLikeLanguageBackend
andCythonLanguageBackend
Source
trait is now generic on a LanguageBackend and gets the language backend instead of a config as an argument ( both backend impls, end up wrapping a config)Source
for the various structs of their
have been moved to the corresponding backend module as there is now one implementation ofSource
perLanguageBackend
for each relevantir
struct.Source
for bothLanguageBackend
s come from the existing impls and have been cleaned to contain only the parts relevant to the language of the Backend for which the impl is forAll tests continue to pass without any modification \o/ (those were quite useful during the refacto)