Replies: 2 comments 1 reply
-
In Android Crypto interop there are functions that we've written in Java rather than C using JNI to call into system libraries. The Java code more closely matches what any other caller code is going to look like. In Apple Crypto interop there are functions written in Swift. We had a big long discussion as to why we don't want to rewrite those into C# (which involved points from above). A lot of things boil down to "C# is the best language[citation needed], but it's not always the best language for every problem"... especially when interoperating with a library built around the concepts/conventions of some other language. |
Beta Was this translation helpful? Give feedback.
-
No. See https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/interop-guidelines.md#unix-shims . In short, we have to rely on the platform C compilers to create a stable ABI for P/Invoke. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
There are still a few native libraries under
src/native/libs
.Is there anything against rewriting them in C#?
If not, is there a plan or concrete issues here?
Nowadays we have Spans & co. and I could imagine that you could get a comparable or even better performance out of many things.
I haven't had a closer look now, but I could imagine some things being feasible, something like
System.Globalization.Native
perhaps?Instead of building a own (wrapper-)library here, we could possibly reference the libraries we still depend on directly via
LibraryImport
. I assume this concerns something like libicu.Also I think
System.IO.Compression.Native
could be done in managed code instead of writing a wrapper around of zlib.The
System.Net.Security.Native
things would probably have to be approached more carefully, but that also seems to me to be within the realms of possibility.Are there any reasons why this is all unmanaged code?
Beta Was this translation helpful? Give feedback.
All reactions