* rpc: type conversion
@ 2010-11-04 21:26 Philippe Strauss
2010-11-04 23:15 ` [Caml-list] " Philippe Strauss
2010-11-05 16:52 ` Jake Donham
0 siblings, 2 replies; 4+ messages in thread
From: Philippe Strauss @ 2010-11-04 21:26 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] rpc: type conversion
2010-11-04 21:26 rpc: type conversion Philippe Strauss
@ 2010-11-04 23:15 ` Philippe Strauss
2010-11-05 1:02 ` Gerd Stolpmann
2010-11-05 16:52 ` Jake Donham
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Strauss @ 2010-11-04 23:15 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] rpc: type conversion
2010-11-04 23:15 ` [Caml-list] " Philippe Strauss
@ 2010-11-05 1:02 ` Gerd Stolpmann
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Stolpmann @ 2010-11-05 1:02 UTC (permalink / raw)
To: Philippe Strauss; +Cc: caml-list
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
------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] rpc: type conversion
2010-11-04 21:26 rpc: type conversion Philippe Strauss
2010-11-04 23:15 ` [Caml-list] " Philippe Strauss
@ 2010-11-05 16:52 ` Jake Donham
1 sibling, 0 replies; 4+ messages in thread
From: Jake Donham @ 2010-11-05 16:52 UTC (permalink / raw)
To: OCaml List
[-- Attachment #1: Type: text/plain, Size: 423 bytes --]
On Thu, Nov 4, 2010 at 2:26 PM, Philippe Strauss <philou@philou.ch> wrote:
> 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:
>
If you are using OCaml on both ends, you might prefer to use orpc:
http://jaked.github.com/orpc/
which generates stubs from OCaml signatures rather than ONC RPC interface
files.
Jake
[-- Attachment #2: Type: text/html, Size: 809 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-05 16:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-04 21:26 rpc: type conversion Philippe Strauss
2010-11-04 23:15 ` [Caml-list] " Philippe Strauss
2010-11-05 1:02 ` Gerd Stolpmann
2010-11-05 16:52 ` Jake Donham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox