csharp_binder
CSharp_Binder is a tool written to generate C# bindings for a Rust FFI (Foreign Function Interface). By interacting over extern C functions, this allows you to easily call Rust functions from C#, without having to write the extern C# functions yourself.
CSharp_Binder will when given a Rust script, parse this script, and extract any functions marked as
extern "C", enums with a [repr(u*)]
attribute, and structs with a #[repr(C)]
attribute. It
will then convert these into appropriate representations in C#.
CSharp_Binder will also extract Rust documentation on functions, enums and their variants, and on structs and their fields, and convert it into XML Documentation on the generated C# code.
Note that CSharp_Binder uses syn to parse Rust scripts, so macros will not be expanded! If you have functions, structs, or enums that need to be extracted inside macros, make sure to run them to something like cargo-expand first.
Examples
Example:
use ;
This would return the following C# code:
// Automatically generated, do not edit!
using ;
using ..;
License: MIT