Address Operator (&)

InstallShield 2024 » InstallScript Language Reference

The address operator is a unary operator that can be used to obtain the memory address of any variable in your script. The operator itself should precede the variable name, with no intervening space. You can use the address operator to assign the address of a variable to a pointer variable or to pass the address of a variable as an argument in a function call. You can send the address to C programs and operate on them as you would any standard C pointer.

In the example below, the address of a data structure is assigned to a pointer variable:

typedef DIMENSIONS

begin

  SHORT sLength;

  SHORT sWidth;

end;

 

DIMENSIONS rectangle;

DIMENSIONS POINTER pointerObject;

 

begin

  pointerObject = &rectangle;

 

  // . .

 

end;

Caution:If you use the address operator with a local variable, be aware that the local variable exists only during the life of the function in which it is declared. After the function returns, the address of the local variable will no longer be valid.

See Also