From: Ian Campbell Subject: Re: [PATCH 22/28] libxl: ocaml: event management Date: Tue, 23 Apr 2013 17:39:54 +0100 Message-ID: <1366735194.20256.196.camel@zakaz.uk.xensource.com> References: <1364222729-6982-1-git-send-email-rob.hoes@citrix.com> <1364222729-6982-23-git-send-email-rob.hoes@citrix.com> <1365684085.8036.99.camel@zakaz.uk.xensource.com> <7EA643C653F17F4C80DE959E978F10ED010F729E0194@LONPMAILBOX01.citrite.net> <1366732694.20256.192.camel@zakaz.uk.xensource.com> <7EA643C653F17F4C80DE959E978F10ED010F729E0196@LONPMAILBOX01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <7EA643C653F17F4C80DE959E978F10ED010F729E0196@LONPMAILBOX01.citrite.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Rob Hoes Cc: Ian Jackson , Dave Scott , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2013-04-23 at 17:30 +0100, Rob Hoes wrote: > > > Good point. The original value may go out of scope in the OCaml > > > program and will then be GC'ed. We should copy the value to avoid > > > trouble. To do that, though, we need to know the type of the thing, > > > which is currently polymorphic. I'll just go ahead and make it a > > > string instead, because that seems to be the most useful. > > > > Is there not a way to take a GC reference on a value or to otherwise make it > > possible for the GC to know you've kept hold of it? > > You can keep the value alive in the "main" function or toplevel. I meant can the C bindings not take a reference to record their taking of the value and stashing it somewhere? > > The bigger issue is the const which actually stops you freeing it, without a > > horrible cast. > > <1365684384.8036.104.camel@zakaz.uk.xensource.com> has more details on > > that one. > > Interesting... But I guess there is no other option than use the cast at the moment? Right. Ian.