3 ms·
Do you have any pointers to projects doing this? I'm very interested in rust and a C# guy during the day. A decent, as in 'serious', example showing rust integ
by darklajid 9y ago
Do you have any pointers to projects doing this?
I'm very interested in rust and a C# guy during the day. A decent, as in 'serious', example showing rust integration would be quite appreciated.
- vvanders 9y agoNothing public unfortunately. It's pretty straightforward though. Just declare a delegate with the same type signature as a your C function callback. Add that as the signature passed in to a native function and C# will make sure to marshal it to a standard C function pointer. Only catch is if you want to keep a hold of the pointer in native you need to make sure to create a GCHandle to the passed in delegate with an identical lifetime. Otherwise the GC will collect the delegate from underneath you.