From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: Damien Doligez <damien.doligez@inria.fr>
Cc: caml-list List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] problem creating .cma library
Date: Sat, 09 Jan 2010 00:38:41 +0100 [thread overview]
Message-ID: <4B47C201.7090201@citycable.ch> (raw)
In-Reply-To: <3EE07409-9559-4B91-BA3E-8787D1378275@inria.fr>
Damien Doligez a écrit :
>
> On 2009-12-31, at 00:30, Guillaume Yziquel wrote:
>
>>> #include <stdio.h>
>>> #include <caml/mlvalues.h>
>>> #include "../mylib/mylib.h"
>>> CAMLprim value
>>> my_print_stub(value v) {
>>
>> CAMLparam1(v); /* is missing here, for garbage
>> collection purposes. */
>>
>>> char* str = (char*)String_val( v );
>>
>> /* You do not need the right-hand side (char*) casting. */
>>
>>> my_print( str );
>>> return Val_unit;
>>> }
>
> If you use CAMLparam1, you must use CAMLreturn instead of return.
Yes. Indeed. Didn't see it.
However, I had a look at
https://yquem.inria.fr/caml/svn/ocaml/version/3.09/byterun/sys.c
and more specifically at the function
> CAMLprim value caml_sys_exit(value retcode)
> {
> #ifndef NATIVE_CODE
> caml_debugger(PROGRAM_EXIT);
> #endif
> exit(Int_val(retcode));
> return Val_unit;
> }
or the function
> CAMLprim value caml_sys_close(value fd)
> {
> close(Int_val(fd));
> return Val_unit;
> }
Why do these functions not follow the usual CAMLparam/CAMLreturn macro
stuff?
--
Guillaume Yziquel
http://yziquel.homelinux.org/
next prev parent reply other threads:[~2010-01-08 23:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-30 17:48 rouanvd
2009-12-30 23:30 ` [Caml-list] " Guillaume Yziquel
2010-01-05 13:04 ` Damien Doligez
2010-01-08 23:38 ` Guillaume Yziquel [this message]
2010-01-08 23:54 ` Basile STARYNKEVITCH
2010-01-09 0:11 ` Guillaume Yziquel
2010-01-09 7:58 ` David Allsopp
2010-01-09 11:33 ` Guillaume Yziquel
2010-01-09 12:52 ` Richard Jones
2010-01-09 14:00 ` Daniel Bünzli
2010-01-09 14:02 ` Daniel Bünzli
2010-01-09 14:21 ` Joel Reymont
2010-01-09 19:36 ` Guillaume Yziquel
2010-01-10 2:11 ` Daniel Bünzli
2010-01-11 17:14 ` Guillaume Yziquel
2010-01-10 13:31 ` ygrek
2010-01-11 18:01 ` Guillaume Yziquel
2010-01-09 19:29 ` Guillaume Yziquel
2010-01-11 12:18 ` Gerd Stolpmann
2010-01-11 17:11 ` Guillaume Yziquel
2010-01-20 14:42 ` Damien Doligez
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=4B47C201.7090201@citycable.ch \
--to=guillaume.yziquel@citycable.ch \
--cc=caml-list@yquem.inria.fr \
--cc=damien.doligez@inria.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