[ocaml-ctypes] ptr ptr argument
Florian Pichlmeier
florian.pichlmeier at mytum.de
Wed Dec 18 12:28:53 GMT 2013
Hi,
i am trying to call this function from ocaml
CZMQ_EXPORT int
zframe_send (zframe_t **self_p, void *socket, int flags);
The function i use to create a new zframe_t is
let create msg =
let stub = foreign "zframe_new"
(string @-> size_t @-> returning (ptr_opt Structs._zframe_t))
in
let msg_size = Size_t.of_int (String.length msg) in
stub msg msg_size
and the structure is defined this way
type zframe_t
let _zframe_t : zframe_t structure typ = structure "_zframe_t"
The problem is with the pointer to pointer argument in the zframe_send function
call.
let send frame socket flags =
let stub = foreign "zframe_send"
((ptr (ptr Structs._zframe_t)) @-> ptr void @-> int @-> returning int)
in
match flags with
| More -> stub (addr frame) socket 1
| Dontwait -> stub (addr frame) socket 4
| More_Dontwait -> stub (addr frame) socket 42
Does someone see, how i can fix my send function to work properly?
Thanks a lot
Florian
More information about the Ctypes
mailing list