Client program

We rewrite the client program with OmniRpcCall.

#include <OmniRpc.h>;
#include <stdio.h>;
#include <math.h>;

int main(int argc,char *argv[]){
   int i;
   double x, res[10];

   OmniRpcInit(&argc,&argv);

   x = 0.0;
   for(i = 0; i < 10; i++){
       OmniRpcCall("calc_sin",x,; res[i]);
       x += 1.0;
   }
   for(i = 0; i < 10; i++) 
      printf("sin(%d)=%g\n",i,res[i]);

  OmniRpcFinalize();

}
      

First, we call OmniRpcInit() before we use the OmniRPC library. And, at end of this program, we call OmniRpcFinalize(). Prototype definitions of these functions are described in OmniRpc.h, so the program must include the "OmniRpc.h" header file.

We compile this program.

% omrpc-cc -o test.exe test.c
      

You can compile without omrpc-cc when you specify the directory of OmniRPC library.

% cc -I/usr/local/omrpc/include \
-o test.exe test.c -L/usr/local/omrpc/lib -lomrpc_client -lomrpc_io 
      

By default, OmniRPC software is installed at /usr/local/omrpc. If you install the software in an other directory, you should change /usr/loca/omrpc to the correct directory in which OmniRPC is installed.