Added C encoding and decoding of object references.