Hello,
first try with TinyCLR 1.0.0 Interop and guess what ?
Interop01_Interop01_MyNativeClass.cpp: In static member function 'static TinyCLR_Result Interop_Interop01_Interop01_MyNativeClass::MyNativeFunc___I4__I4(TinyCLR_Interop_MethodData)':
Interop01_Interop01_MyNativeClass.cpp:10:31: error: invalid initialization of reference of type 'const TinyCLR_Interop_StackFrame&' from expression of type 'int'
ip->GetArgument(ip, 0, arg);
^
make: *** [Interop01_Interop01_MyNativeClass.obj] Error 1
I have used the sample provided on this page and only changed the name of the class from âInteropTestâ to âInterop01â.
Here is the code :
#include âInterop01.hâ
TinyCLR_Result Interop_Interop01_Interop01_MyNativeClass::MyNativeFunc___I4__I4(const TinyCLR_Interop_MethodData md)
{
auto ip = md.InteropManager;TinyCLR_Interop_ClrValue arg; TinyCLR_Interop_ClrValue ret; ip->GetArgument(ip, 0, arg); // Compilation error here ip->GetReturn(ip, md.Stack, ret); ret.Data.Numeric->I4 = arg.Data.Numeric->I4 * arg.Data.Numeric->I4; return TinyCLR_Result::Success; } TinyCLR_Result Interop_Interop01_Interop01_MyNativeClass::get_MyNativeProperty___I4(const TinyCLR_Interop_MethodData md) { auto ip = md.InteropManager; const TinyCLR_Interop_ClrObject* self; TinyCLR_Interop_ClrValue field; TinyCLR_Interop_ClrValue ret; ip->GetThisObject(ip, md.Stack, self); ip->GetField(ip, self, Interop_Interop01_Interop01_MyNativeClass::FIELD___field___I4, field); ip->GetReturn(ip, md.Stack, ret); ret.Data.Numeric->I4 = field.Data.Numeric->I4; return TinyCLR_Result::Success; }
What am I doing wrong ?