From: Mikhail Fedotov <mikhail@kittown.com>
To: "Jean-Baptiste Rouquier" <jb.rouquier@wanadoo.fr>
Cc: caml-list@inria.fr
Subject: Re[2]: [Caml-list] interfacing C and OCaml
Date: Fri, 27 Jun 2003 09:24:59 +0400 [thread overview]
Message-ID: <54997465.20030627092459@kittown.com> (raw)
In-Reply-To: <003001c33c17$343a0d80$355afac1@zofo>
Hi!
JBR> 1. Should I use
JBR> CAMLprim value input(value channel, value buffer, value offset, value
JBR> length)
JBR> {
JBR> return ...
JBR> }
Yes. This function can be called from other C function or from OCaml.
JBR> as in 18.1.2 in the manual, or
JBR> void foo (value v1, value v2, value v3)
JBR> {
JBR> CAMLparam3 (v1, v2, v3);
JBR> ...
JBR> CAMLreturn0;
JBR> }
This if for functions called from C only. Not suitable for use from
OCaml directly.
Should be specified in the manual, I believe, but I've got no response
in the list to my comment on this. I hope it will be in the manual for
the OCaml 3.07.
JBR> ------------------------------------------------
JBR> 3. Is it correct to store p in the custom block v by
JBR> CAMLlocal(v);
JBR> v = alloc_custom(ops, 4, 0, 1);
JBR> (my_type *) Data_custom_val(v) = p;
JBR> ?
JBR> When does the parameter "size" (here "4") vary ?
CAMLlocal(v);
my_type *t;
my_type r;
v = alloc_custom(ops, 1 + sizeof(my_type), 1, 10);
t = (my_type *) Data_custom_val(v);
t->some_int_member = 7;
Mikhail
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2003-06-27 5:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-26 14:42 Jung Woon Ho
2003-06-26 15:14 ` Lex Stein
2003-06-26 19:02 ` Jean-Baptiste Rouquier
2003-06-27 5:24 ` Mikhail Fedotov [this message]
2003-06-27 8:31 ` Jean-Baptiste Rouquier
2003-06-27 8:59 ` Re[2]: " Mikhail Fedotov
2003-06-27 12:57 ` art yerkes
2003-06-27 13:14 ` Re[4]: " Mikhail Fedotov
2003-06-27 17:45 ` art yerkes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54997465.20030627092459@kittown.com \
--to=mikhail@kittown.com \
--cc=caml-list@inria.fr \
--cc=jb.rouquier@wanadoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox