Look up relevant globals at API entry points

The previous commit broke using 'local' on the global variables, since
that replaces the symbol table entry with a new SV temporarily.