FunctionAddressMethod

Applies to:Fast Math Parser
Class:uCalc.Item
Returns the callback address of a defined function (or operator)
Syntax
FunctionAddress()
Remarks
The returned value is the actual Pointer address of the function as used by uCalc internally, and not a uCalcCallback, even in .NET. As such, in .NET this value can be used in the more general Define function but not functions like DefineFunction or DefineneOperator.
Example 1: Defining another Abs function using the same callback address of existing one

uc.Define("Function: MyAbs(x)", uc.GetItemOf("Abs").FunctionAddress())
Console.WriteLine(uc.Eval("MyAbs(-123)")) ' Returns 123

          

uc.Define("Function: MyAbs(x)", uc.GetItemOf("Abs").FunctionAddress());
Console.WriteLine(uc.Eval("MyAbs(-123)")); // Returns 123;

          

      uc.Define('Function: MyAbs(x)', (void *)uc.GetItemOf('Abs').FunctionAddress());
      WriteLn(uc.Eval('MyAbs(-123)')); // Returns 123;

          

uc.Define("Function: MyAbs(x)", (void *)uc.GetItemOf("Abs").FunctionAddress());
cout << uc.Eval("MyAbs(-123)") << endl; // Returns 123;

          

uc.Define("Function: MyAbs(x)", (void *)uc.GetItemOf("Abs").FunctionAddress());
Console::WriteLine(uc.Eval("MyAbs(-123)")); // Returns 123;

          
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="FunctionAddress")> _

Private Function FunctionAddress__(ByVal ItemHandle As IntPtr) As  IntPtr
End Function
            
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="FunctionAddress")]

protected static extern  IntPtr FunctionAddress_(IntPtr ItemHandle);
            
{DLLImport}function FunctionAddress__(ItemHandle: System.Pointer):  System.Pointer; cdecl; external uCalcDLL name 'FunctionAddress';

            
typedef  uCalcCallback (* __FunctionAddress)(void *ItemHandle); 

            
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "FunctionAddress")]

static uCalcCallback FunctionAddress_(void *  ItemHandle);
            
Prev | Next