The same rule applies to calling "^xdr" (i.e. calling the "xdr" method on the superclass), always use the function
instead. Since inst always exists at the point where g_xdr_superclass is called only an instance pointer is needed as second parameter.bool_t g_xdr_superclass(XDR *xdrp, INSTANCE *inst)
Like g_xdr_instance this function is responsible for handling class information, especially skipping unknown (super)classes, and calling "xdr" on the superclass.
As example we use the "xdr" method on the Chain subclass of Scene which just adds a flag:
CHAIN *chain_xdr(XDR *xdrp) { CHAIN *self; int ver = 1; self = (CHAIN *)START_METHOD(G_INSTANCE); ASSURE(self, "", END_METHOD(NULL)); if(!g_xdr_version(xdrp, &ver) || !g_xdr_superclass(xdrp, (INSTANCE *)self) || ! xdr_int(xdrp, &self->flag)) END_METHOD(NULL); END_METHOD(self); }
g_xdr_superclass should always be called right after g_xdr_version and before any other XDR functions on the instance variables (this is not really necessary but it keeps the structure of all "xdr" methods consistent).
Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.