Additional Topics > External Development Guide > IDLInternals - Variables > Looking Up Main Program Variables

# Looking Up Main Program Variables

The IDL_GetVarAddr() function returns the address of a main program variable, given its name:

IDL_VPTR IDL_GetVarAddr(char *name)

The return value is NULL if the variable does not exist, otherwise the pointer to the variable is returned.

Alternatively, IDL_GetVarAddr1() will enter a new variable into the symbol table of the main program if called with the parameter ienter set to TRUE, and the specified variable name does not already exist. Otherwise, its operation is the same as IDL_GetVarAddr(). Note that new variables cannot be created if a user procedure or function is active. IDL_GetVarAddr1() is called as shown following:

IDL_VPTR IDL_GetVarAddr1(char *name, int enter)

### name

Points to the null terminated name of the variable, which must be in upper case.

### ienter

Set this parameter to TRUE to create the variable if it does not already exist.

If ienter is TRUE and the specified variable name does not already exist, it will be added to the symbol table of the main program. If ienter is FALSE, IDL_GetVarAddr1() is equivalent to IDL_GetVarAddr().