Macro wrapped_mono::add_internal_call
source · add_internal_call!() { /* proc-macro */ }
Expand description
Macro equivalent of mono_add_internal_call
with automatic support for type conversion.
Allows you to expose a function as an internal call
Parameters
Name | Type | Purpose |
---|---|---|
function_path | string literal(“”) | Path to managed function to replace with internal call. Example: “NAMESPCE.CLASS::Method ”. Managed method to replace must have [MethodImpl(MehodImplOption.InternalCall)] atribute |
function | rust function | Rust function with invokable macro. Must match signature of managed function, otherwise undefined beahviour may occcur. |
Example
CSharp
using System.CompilerServices;
namespace SomeNamespace{
class SomeClass{
[MethodImpl(MehodImplOption.InternalCall)]
void DoSomething(String arg1);
}
}
Rust
#[invokable]
fn do_something(input:String){
println!("done something:{}",input);
}
fn expose_do_something(){
add_internal_call!("SomeNamespace.SomeClass::DoSomething()")
}