If a file with extension .tcl is located inside the GiD 'plugins' folder, with the same name as the folder containing it, then it is automatically sourced when starting GiD.
This allow to do what the developer want, with Tcl language, e.g. change menus, source other Tcl files or load a 'Tcl loadable library' that extend the Tcl language with new commands implemented at C level.
To know how to create a 'Tcl loadable library' some Tcl book must be read.
See chapter about 'C Programming for Tcl' of
"Practical Programming in Tcl and Tk" by Brent Welch, Ken Jones, and Jeff Hobbs at http://www.beedub.com/book