caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florent Monnier <fmonnier@linux-nantes.fr.eu.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] wrapping external classes
Date: Thu, 11 Dec 2008 17:21:28 +0100	[thread overview]
Message-ID: <200812111721.28440.fmonnier@linux-nantes.fr.eu.org> (raw)
In-Reply-To: <49412CC8.5080902@frisch.fr>

> >     (* use a destroy method explicitly if you need to make sure the
> > destructor * is called --- Gc.finalise doesn't guarantee this (e.g. the
> > program might * terminate before the finalisation function is executed)

you can use at_exit to garanty a call before termination

> If the handle is really an OCaml integer, it is not possible to attach a
> finalizer to it. The finalizer could be attached to the object that
> wraps the handle; but the best solution is to use custom blocks and C
> finalizers in the C binding.

if you are not so fluent in C/C++ there is this work-around that does work:
http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php#ref_finalise
but indeed the classic way is to use the custom_operations struct:
http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php#ref_custom


      reply	other threads:[~2008-12-11 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11  2:20 Alexy Khrabrov
2008-12-11 10:37 ` [Caml-list] " Mauricio Fernandez
2008-12-11 15:07   ` Alain Frisch
2008-12-11 16:21     ` Florent Monnier [this message]

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=200812111721.28440.fmonnier@linux-nantes.fr.eu.org \
    --to=fmonnier@linux-nantes.fr.eu.org \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).