I think my suggestion elsewhere should work without any modifications to Gm. The functions that are calling the "global function library functions" will need some minor mods -- and, if they are a library, they probably should be defined globally, anyway, so any function can reference them.