GetSymbolLocation (symbol_name)

Returns the location of the symbol name specified in symbol_name. The location is returned in a Symbol record. An empty string is returned if the symbol is not found. See also “Symbol Record”.

This function performs a look up operation the same way that Source Insight looks up symbols when you use the Jump To Definition command. If the symbol is not found in the current project, or any open file, then all the projects on the project symbol path are searched as well. If more than one declaration is found for symbol_name, then the user is presented with a multiple-definition list to select from.

You can also call GetSymbolLocationEx for more control over how the lookup operation is performed, and to locate multiple definitions of the same symbol name.

This example looks up the definition of a symbol and displays its source file and line number.

symbol = Ask("What symbol do you want to locate?")
loc = GetSymbolLocation(symbol)
if (loc == "")
    Msg (symbol # " was not found")
    Msg (symbol # " was found in " # loc.file # 
            " at line " # loc.lnFirst)

In this section: