From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 7CAD3BBAF for ; Fri, 21 May 2010 00:04:24 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAK9O9UtQRFuw/2dsb2JhbACeGnG/QIUSBA X-IronPort-AV: E=Sophos;i="4.53,273,1272837600"; d="scan'208";a="51563938" Received: from furbychan.cocan.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 21 May 2010 00:04:24 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1OFDqo-0004hP-Nb; Thu, 20 May 2010 23:04:22 +0100 Date: Thu, 20 May 2010 23:04:22 +0100 To: lyn HONG Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] What should the "size" in "caml_alloc_custom" be? Message-ID: <20100520220422.GA18027@annexia.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; alloc:01 allocating:01 ocaml:01 alloc:01 pointer:01 pointer:01 ocaml:01 wrote:01 caml-list:01 caml:02 caml:02 ops:03 size:95 size:95 hong:94 On Mon, May 17, 2010 at 02:00:28PM -0400, lyn HONG wrote: > I have a question about "allocating custom blocks" in "iterfacing C with > object Ocaml". when we call function "caml_alloc_custom(ops, size, used, > max)" in the C side, if the structure we want to allocate has a pointer, is > the "size" going to be size of the structure itself only, or should we also > include the memory block that pointer points to? This example code might be helpful: http://oirase.annexia.org/libguestfs-1.3.13/ocaml/guestfs_c.c.html and more here: http://oirase.annexia.org/libguestfs-1.3.13/ocaml/ Rich. -- Richard Jones Red Hat