Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Calling C from OCaml, GC problems
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Max Skaller <maxs@i...>
Subject: Re: Calling C from OCaml, GC problems
> However, the second warning is still there (even if harmless). The
> problem is that the caml__dummy_##name variables are no longer
> used. Such variable is only used to make some side-effects using C
> '(stmt1, stmt2, ..., stmtN)' notation. I see no way to fix this. C lack
> the Caml 'let _ ='. :)

I'd recommend getting rid of those macros. Anyone writing
a CAML/C interface needs to understand details of how the GC
works so as to optimise code to exactly the required
functions to create temporary roots, etc .. it would be better
to provide the raw functions and a good explanation.

For example, the documentation says 'it is safe to
cast C malloced pointers to caml values' which, in English
at least, does NOT tell me what I need to know -- that the
caml GC 'knows' that such values are not pointers into it's heap.

For example, I did some work on a copy of mlgtk, and the requirements
lead to fairly idiosyncractic code -- code wrapping a single
simple object never needs to make the temporary roots; but if
there are two objects, the first created needs to be rooted.

I do wonder if it would not be useful to have a function(s)
that did allocations without collecting.

John (Max) Skaller at OTT [Open Telecommications Ltd]      -- at work  -- at home