FFI: implement the global reference functions