lang • varptr

VarPtr

Pointer = VarPtr ( Variable )

Returns a pointer that points at the Variable contents in memory.

  • Variable must be a local variable, or a global variable of the current class.

  • The datatype of the variable must be a number, a date, or a pointer.

  • It can be a string only for global variables. In that case, the returned pointer is not the address of the string contents, but the address of a pointer that points at the string contents.

Since 3.15

  • Variable can be a Variant too. But beware, the returned pointer is guaranteed to be valid until the datatype of the variant changes.

Use this function when an extern function argument is a pointer to a numeric variable. For example, int *, or void **.

Do not use it to deal with char **, because the contents of a Gambas string variable is read-only.

See also