Refactor mapping of external C functions into a separate module, and only map them once