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: 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)
GetSymbolLocation can also look up file names. By giving a simple file name as the symbol_name parameter, GetSymbolLocation can look up the file in the project, or on the project symbol path, and return the fully qualified path to the file in the location.file field. This can be useful for expanding a simple file name into its full path.
loc = GetSymbolLocation("simple.c")
fullfilename = loc.file
// fullfilename could be something like "d:\proj\simple.c"