In the Foreign Include File section, there is subsection 12.4.9, Serializing and deserializing Prolog terms. If I am reading this correctly, it only discusses de-serialization through PL_put_term_from_chars().
Is the serialization meant to be done with PL_get_chars() and PL_get_nchars(), using the flag CVT_WRITE_CANONICAL?