From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 43B98BB91 for ; Thu, 21 Jul 2005 12:28:23 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6LASMvM002070 for ; Thu, 21 Jul 2005 12:28:22 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA12456 for ; Thu, 21 Jul 2005 12:28:22 +0200 (MET DST) Received: from comtv.ru (mail.comtv.ru [217.10.32.19]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6LASLGB002098 for ; Thu, 21 Jul 2005 12:28:21 +0200 X-UCL: actv Received: from av1474.oops ([10.0.66.9] verified) by comtv.ru (CommuniGate Pro SMTP 4.1.8) with ESMTP id 68027241; Thu, 21 Jul 2005 14:28:18 +0400 Date: Thu, 21 Jul 2005 14:29:02 +0400 (MSD) From: malc X-X-Sender: malc@home.oyster.ru To: Jacques Garrigue Cc: roessler@rftp.com, caml-list@inria.fr Subject: Re: [Caml-list] A pair of "Interfacing with C" questions In-Reply-To: <20050721.192154.31710299.garrigue@math.nagoya-u.ac.jp> Message-ID: References: <42DF2A64.4000600@rftp.com> <20050721.192154.31710299.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 42DF78C6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42DF78C5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; malc:01 malc:01 pulsesoft:01 caml-list:01 interfacing:01 widget:01 widget:01 terminating:01 byte:01 ocaml:01 pointers:01 nativeint:01 mlvalues:01 nativeint:01 pointer:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Thu, 21 Jul 2005, Jacques Garrigue wrote: > From: Robert Roessler > >> 1) in wrapping a large widget with multiple interfaces using >> "strings", I sometimes allow the widget to copy a C-string into a >> Caml-allocated string - INCLUDING "overwriting" the terminating zero >> byte with zero... I wanted to make sure this was not seen as a major >> problem. > > No problem currently: for C compatibility all ocaml strings have a 0 > after their end. Nobody can give "future" guarantees, but if there is > a change at this level, I assume this would be well publicised. > >> 2) this is about "future-proofing" (at the source level) code which >> interfaces with external [foreign] components and needs to store and >> pass around "opaque pointers": what is the best base Caml data type to >> use? >> >> I currently use >> >> type opaque_ptr = int32 >> >> I assume the other choices include int64, nativeint, or even int. > > If you look at mlvalues.h you will see that nativeint is define as > long int. So this should be the natural format for a pointer. I don't think so, Win64 ABI has sizeof(long) == 4 and sizeof(void *) == 8. -- mailto:malc@pulsesoft.com