From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 92844BC57 for ; Fri, 5 Nov 2010 02:02:55 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUBAD300kzU4xEJkWdsb2JhbACDKZARjjUVAQEBAQkLCgcRAx+sQZEIAoEggzJzBIcFhlg X-IronPort-AV: E=Sophos;i="4.58,299,1286143200"; d="scan'208";a="65000360" Received: from moutng.kundenserver.de ([212.227.17.9]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Nov 2010 02:02:55 +0100 Received: from office1.lan.sumadev.de (dslb-188-097-070-228.pools.arcor-ip.net [188.97.70.228]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MW8Zl-1P2qyF1oRl-00Xvvm; Fri, 05 Nov 2010 02:02:54 +0100 Received: from [192.168.1.213] (64-71-1-165.static.wiline.com [64.71.1.165]) by office1.lan.sumadev.de (Postfix) with ESMTPA id 6058A5F702; Fri, 5 Nov 2010 02:02:53 +0100 (CET) Subject: Re: [Caml-list] rpc: type conversion From: Gerd Stolpmann To: Philippe Strauss Cc: caml-list@inria.fr In-Reply-To: <4CD33E95.4010901@philou.ch> References: <4CD32508.6080102@philou.ch> <4CD33E95.4010901@philou.ch> Content-Type: text/plain; charset="UTF-8" Date: Fri, 05 Nov 2010 02:02:50 +0100 Message-ID: <1288918970.6102.13.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:143y0/ISa7VOhr7vq4qm180BcF22v3TGi7FZInF9R7D lUNbBZZqum4HfAZo+OI8d6ydvV+xJSZUTq1DBLAKfgBYLyLmHv SrRrN7LFlXnuiRpaTivLhAYSqX6KE7670FlvJneOfwreytm9Xb Zan1wkccXph9ziie1YAcK/wJYctL8bapxNrOnIFgxlXqP3JJgp xQdzMbLt1DNumdb2hbFTQ== X-Spam: no; 0.00; gerd:01 stolpmann:01 int's:01 unboxed:01 unboxed:01 ocamlnet-:01 gerd:01 lacks:01 lacks:01 beginner's:01 ocaml:01 bug:01 beginner's:01 ocaml:01 bug:01 Alternatively, you can instruct ocamlrpcgen to directly translate RPC int's to int/int32/int64. E.g. "ocalmrpcgen -int unboxed", or you demand the types in the .x file, e.g. use "_unboxed int". See the manual for details: http://projects.camlcity.org/projects/dl/ocamlnet-3.0.3/doc/html-main/Rpc_intro.html, section "Mapping integer types". Gerd Am Freitag, den 05.11.2010, 00:15 +0100 schrieb Philippe Strauss: > oops, Rtypes.int_of_int4 and int4_of_int. > > sorry. > > Philippe Strauss wrote: > > 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 > > > > _______________________________________________ > > Caml-list mailing list. Subscription management: > > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > > Archives: http://caml.inria.fr > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- ------------------------------------------------------------ Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------