NordSecurity / uniffi-bindgen-cs

C# bindings generator for uniffi-rs
https://github.com/NordSecurity/uniffi-bindgen-cs
Mozilla Public License 2.0
109 stars 21 forks source link

Fix short lived callback lifetimes #89

Closed arg0d closed 2 months ago

arg0d commented 2 months ago

Alternative to https://github.com/NordSecurity/uniffi-bindgen-cs/pull/88.

I like this one better, there is 1 less dictionary lookup.

I tried to use a struct ("stack" allocated), but C# does not allow to modify struct in-place in dictionary, so modifying refcount in a struct requires 2 lookups. Compared with a single object dereference in this MR, I think object dereference is the better option?

arg0d commented 2 months ago

Hmm, but this MR requires needless object dereference on each lookup, compared with #88 (each callback method call).