Version française
Home     About     Download     Resources     Contact us    
Browse thread
rpc: type conversion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Philippe Strauss <philou@p...>
Subject: rpc: type conversion
Hello,

I need to use RPC in a current project of mine, but I don't get how do 
you write the type conversion and what is provided, taking a very basic 
example:

--8<--
program Rpc_control {
     version V1 {
                 int                     add(int, int)        = 1;
     } = 1;
} = 0x2000007f;
--8<--

and the server code:

--8<--
let add arg =
     match arg with
     | (a, b) -> a + b
     | _ -> 0

let _ =
     let esys = Unixqueue.standard_event_system () in
     let server = Deconv_srv.Rpc_control.V1.create_server ~proc_add: add
         (Rpc_server.Localhost 3333) Rpc.Tcp Rpc.Socket esys in
     Unixqueue.run esys
--8<--

my add fun is wrong regarding the types, I've read about type conversion 
but the doco lacks examples, the examples lacks basic use of int <-> 
Rtype.int4.


Thanks