You dont need to worry about calling conventions in C#, since you cant export functions like that. However, you will need to learn how to use delegates.
You need to create a delegate called func, which accepts one byte parameter (to match your Func typedef):
C#:
public delegate void Func(byte b);
This is sort of a prototype for a function. You then need to place it in your functions parameter signature:
C#:
public myFunction(byte id, Func f) {
// code here
}
You then have to create a function which matches the signature of the Func delegate, and pass that to your function. So:
C#:
public delegateFunction(byte b) { // matches Funcs signature
// do stuff with [b]b[/b] here
}
And when you call your first function:
C#:
myFunction(42, new Func(delegateFunction));
This is probably very confusing for you, but if you look up delegates in the MSDN, youll find tons of information.
I will try it out. I was reading a bit about delegates. And it was written that it was preferable to make interfaces instead of delegates because of the type safety. What do you think about it ?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.