Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Tomasz Zielonka <zielony@cs.net.pl>
To: CAML list <caml-list@inria.fr>
Subject: [Caml-list] Using C values in ocaml code
Date: Thu, 31 Jan 2002 11:11:12 +0100	[thread overview]
Message-ID: <20020131101112.GA30020@cs.net.pl> (raw)

Hi

I'm linking ocaml code with a program written in C. I want to use
some C type values within ocaml code (store in structures, pass around,
apply to external functions, etc.). Below is a simplified example:

  type cvalue

  external get_some_value : unit -> cvalue = "get_some_value"
  external process_value  : cvalue -> cvalue = "process_value"

example C primitive:

  value
  get_some_value(value unit)
  {
    CAMLparam1(unit);
    Datum x;
    x = foo();
    CAMLreturn((value) x)
  }

What I'm afraid of is: 
  Can there be any problem with Garbage Collector
... if cvalue is word aligned pointer? (I think I'll be ok)
... if cvalue can have any value?

My situation is that cvalue is word with any value possible - eg. it
can be a pointer or an integer.

Do I have to put it in a custom block or something?

tom

-- 
   .-.   Tomasz Zielonka                           CYBER SERVICE
   oo|   programista                        http://www.cs.net.pl
  /`'\   zielony@cs.net.pl
 (\_;/)  tel: [48] (22) 723-06-79 | tel/fax: [48] (22) 723-01-75
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2002-01-31 10:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-31 10:11 Tomasz Zielonka [this message]
2002-01-31 11:12 ` Markus Mottl
2002-01-31 15:05   ` Tomasz Zielonka
2002-01-31 15:23     ` Markus Mottl

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=20020131101112.GA30020@cs.net.pl \
    --to=zielony@cs.net.pl \
    --cc=caml-list@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