uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

ValueAddr(ADDR)

Method

Product: 

Fast Math Parser

Class: 

Item

Re-points a host-bound (proxy) variable to a new memory address at runtime.

Syntax

ValueAddr(ADDR)

Parameters

newAddress
ADDR
The new memory address that the uCalc variable will point to. The data at this address must be compatible with the variable's defined data type.

Return

void

This method does not return a value.

Remarks

This method re-points a host-bound uCalc variable to a new memory address in the host application. It is the setter for the ValueAddr() property and is a powerful tool for low-level memory integration.

🔗 Host-Bound (Proxy) Variables

This method applies only to variables that were created as proxies for data in your host application. A proxy variable is created by passing a memory address to uCalc.DefineVariable():

// Binds 'ucVar' to the memory location of 'hostVar' var ucVar = uc.DefineVariable("myVar", AddressOf(hostVar));

In this state, ucVar does not have its own storage within uCalc; it is simply a named reference to an external memory location.

ValueAddr() vs. Value()

It is crucial to understand the difference between this method and the Item.Value() setter:

  • item.Value(newValue): This changes the data at the currently pointed-to memory address. It modifies the value of the host variable.
  • item.ValueAddr(newAddress): This changes the address itself. It makes the uCalc variable stop pointing to the old host variable and start pointing to a new one.

💡 Comparative Analysis

  • vs. C++ Pointers: This behavior is directly analogous to reassigning a pointer in C++.

    int a = 10, b = 99;int* p = &a; // p points to ap = &b;      // Now p points to b. This is what ValueAddr() does.
  • vs. C# References: In safe C#, you cannot easily "re-seat" a reference (ref) variable to point to a different memory location after it has been initialized. uCalc's ValueAddr() provides a level of dynamic, low-level control that is typically only available in unsafe or unmanaged code, making it a powerful feature for high-performance integrations.

Examples