base: avoid global lookups when compiling in API