5.1 Invoking grpc-compile

The grpc-compile command provides a simple command-line
interface to the XDR/RPC language compiler (see Compiler). It reads
a RPC definitions written in the XDR/RPC language on the standard input
and, depending on the options, write Scheme code containing client,
server, data type or constant definitions on the standard output.

--help

Print a summary of the command-line options and exit.

--version

Print the version number of GNU Guile-RPC and exit.

--xdr

-x

Compile XDR type definitions.

--constants

-C

Compile XDR constant definitions.

--client

-c

Compile client RPC stubs.

--server

-s

Compile server RPC stubs.

--strict

-S

Use strict XDR standard compliance per RFC 4506,
Section 6. By default, the compiler recognizes extensions implemented
by Sun Microsystems, Inc., and also available in the GNU C Library’s
rpcgen. These extensions include:

support for % line comments; these are actually treated
as special directives by rpcgen but they are simply ignored by
grpc-compile;

support for the char type, equivalent to int;

support for the unsigned type, equivalent to
unsigned int;

the ability to use struct in type specifiers;

the ability to use string as the type specifier of a
procedure parameter.

Also note that some XDR/RPC definition files (.x files)
originally designed to be used in C programs with rpcgen include
C preprocessor directives. Unlike rpcgen, which automatically
invokes cpp, such input files need to be piped through
cpp -P before being fed to grpc-compile.

The various pieces of generated code can also be stored in separate
files. The following example shows how to create one file containing
constant and type definitions, another one containing client stubs, and
a third one containing server stubs. Since the two last files depend on
the first one, care must be taken to load them beforehand.