Browse thread
[Caml-list] Using C values in ocaml code
- Tomasz Zielonka
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Tomasz Zielonka <zielony@c...> |
| Subject: | [Caml-list] Using C values in ocaml code |
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