generate externally-callable global functions