ValueAddrMethod
Example 1: Playing with pointers
Dim x = uc.DefineVariable("x As Int16 = -1")
Dim MyPointer = uc.DefineVariable("xPtr As Pointer")
MyPointer.SetVariableValuePtr(x.ValueAddr())
Console.WriteLine(uc.EvalStr("ValueAt(Int16u, xPtr)"))
var x = uc.DefineVariable("x As Int16 = -1");
var MyPointer = uc.DefineVariable("xPtr As Pointer");
MyPointer.SetVariableValuePtr(x.ValueAddr());
Console.WriteLine(uc.EvalStr("ValueAt(Int16u, xPtr)"));
MyPointer.SetVariableValuePtr(x.ValueAddr());
WriteLn(uc.EvalStr('ValueAt(Int16u, xPtr)'));
auto x = uc.DefineVariable("x As Int16 = -1");
auto MyPointer = uc.DefineVariable("xPtr As Pointer");
MyPointer.SetVariableValuePtr(x.ValueAddr());
cout << uc.EvalStr("ValueAt(Int16u, xPtr)") << endl;
auto x = uc.DefineVariable("x As Int16 = -1");
auto MyPointer = uc.DefineVariable("xPtr As Pointer");
MyPointer.SetVariableValuePtr(x.ValueAddr());
Console::WriteLine(uc.EvalStr("ValueAt(Int16u, xPtr)"));
Example 2: Setting a variable value by pointer
Dim x = uc.DefineVariable("x = 123")
Dim y = uc.DefineVariable("y")
y.SetVariableValueByPtr(x.ValueAddr())
Console.WriteLine(uc.Eval("x"))
var x = uc.DefineVariable("x = 123");
var y = uc.DefineVariable("y");
y.SetVariableValueByPtr(x.ValueAddr());
Console.WriteLine(uc.Eval("x"));
y.SetVariableValueByPtr(x.ValueAddr());
WriteLn(uc.Eval('x'));
auto x = uc.DefineVariable("x = 123");
auto y = uc.DefineVariable("y");
y.SetVariableValueByPtr(x.ValueAddr());
cout << uc.Eval("x") << endl;
auto x = uc.DefineVariable("x = 123");
auto y = uc.DefineVariable("y");
y.SetVariableValueByPtr(x.ValueAddr());
Console::WriteLine(uc.Eval("x"));
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="ValueAddr")> _
Private Function ValueAddr__(ByVal ItemHandle As IntPtr) As IntPtr
End Function
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="ValueAddr")]
protected static extern IntPtr ValueAddr_(IntPtr ItemHandle);
{DLLImport}function ValueAddr__(ItemHandle: System.Pointer): System.Pointer; cdecl; external uCalcDLL name 'ValueAddr';
typedef void * (* __ValueAddr)(void *ItemHandle);
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "ValueAddr")]
static void * ValueAddr_(void * ItemHandle);