The most common method of doing this is by the use of stub modules. The client program is linked to a client stub module. This is a subroutine which looks (from the outside) in every respect like the remote subroutine. On the inside, it is almost empty: all it does is take the values of the parameters which are passed to it, and put them in a message. This is known as marshalling.
The client stub then uses a routine in the RPC Run-Time System (RTS) to send the message off and wait for a reply message. When the reply arrives, the stub unmarshals the parameters that were returned in the reply message, putting their values into the variables of the calling program. The client stub then returns to the calling program just like a normal subroutine.
The server stub is located on the remote machine. It is called by the RPC run-time system when the message arrives from the client. The server stub performs the operations complementary to those of the the client stub: unmarshalling the parameters passed to the subroutine, calling the subroutine, and marshalling the return parameters.
(picture ommitted) The software components of a remote call.
All the communication details are handled by the RPC run-time system, so the stubs contain only the code which is specific to the application involved. Each stub handles a specific set of procedures known as a package.
In order to produce stub modules, one needs to know