Re: Calling C from OCaml, GC problems

From: Max Skaller (maxs@in.ot.com.au)
Date: Tue Feb 22 2000 - 00:41:16 MET

  • Next message: Jacques Garrigue: "Re: Preferred GUI Toolkit for O'Caml 3?"

     
    > 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]
    mailto:maxs@in.ot.com.au      -- at work
    mailto:skaller@maxtal.com.au  -- at home
    



    This archive was generated by hypermail 2b29 : Tue Feb 22 2000 - 11:52:38 MET