Hacker News new | past | comments | ask | show | jobs | submit login

It is very easy to call a C# method from C++, since .NET has a COM interop layer. From C++ this will just look as a class with no fields but a bunch of virtual methods. Alternatively, you can easily convert a static method to a native function pointer and then invoke that - this way it's also easy to do from C, Rust, and just about anything else that speaks the C ABI.

If your C# method doesn't take any arguments like managed strings or arrays that require marshaling, it's also very cheap (and there's unsafe pointers, structs, and fixed arrays that can be used at interop boundary to avoid marshaling even for fairly complicated data structures).

.NET was very much designed around these kinds of things. It's not a coincidence that its full type system covers everything that you can find in C.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: