Next: , Previous: , Up: Stand-Alone Tools   [Contents][Index]

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.


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


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


Compile XDR type definitions.


Compile XDR constant definitions.


Compile client RPC stubs.


Compile server RPC stubs.


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:

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.


Output the intermediate form produced by the parser (see Parser).

Code generation options can be combined. For instance, the command line below writes data type and constant definitions as well as client stubs in a single file:

$ grpc-compile --xdr --constants --client < input.x > client-stubs.scm

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.

$ grpc-compile --xdr --constants < input.x > types+constants.scm
$ echo '(load "types+constants.scm")' > client-stubs.scm
$ grpc-compile --client < input.x >> client-stubs.scm
$ echo '(load "types+constants.scm")' > server-stubs.scm
$ grpc-compile --server < input.x >> server-stubs.scm

In the future, there may be additional --use-module and --define-module options to make it easier to use Guile’s module system in generated code.

Next: , Previous: , Up: Stand-Alone Tools   [Contents][Index]