caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Using C values in ocaml code
@ 2002-01-31 10:11 Tomasz Zielonka
  2002-01-31 11:12 ` Markus Mottl
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Zielonka @ 2002-01-31 10:11 UTC (permalink / raw)
  To: CAML list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-01-31 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31 10:11 [Caml-list] Using C values in ocaml code Tomasz Zielonka
2002-01-31 11:12 ` Markus Mottl
2002-01-31 15:05   ` Tomasz Zielonka
2002-01-31 15:23     ` Markus Mottl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).