I am calling a Rust function in a native DLL from C# like this:
[DLLImport("rust.dll")]
public static int Foo(int i);
public static void Invoke() {
typeof(Program).GetMethod("Foo").Invoke(new object[] {null}, new object[] {1});
}
public static void Call() {
Foo(1);
}
I want to check if a the method is called directly or by using Invoke
. If it's invoked the method should print "Invoked"
, if not it should print "Called"
. I'm not really sure if you can differentiate between these two things, thats why I'm asking :P.
Aucun commentaire:
Enregistrer un commentaire