Before actually creating a client or server for this interface, one must
define the types it uses. The simplest way to define one or several
data types is to pipe their definition in XDR/RPC language through the
$ grpc-compile --xdr --constants < input.x > types.scm
Given the description from input.x in RPC language, this command
generates code that provides access to the constants and data types
defined therein. The resulting Scheme code, types.scm, can then
loaded in other Scheme files (see Loading in The GNU
Guile Reference Manual).
In addition, code in types.scm depends on Guile-RPC modules that it uses at run-time. Thus, it must first import the relevant modules:
(use-modules (rpc xdr) (rpc xdr types))
result_t type is defined (this is the code generated by
the compiler but it can also be written “by hand”):
(define result-type (make-xdr-struct-type (list xdr-integer ;; `integer_part' xdr-unsigned-integer))) ;; `decimal_part'