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 F2A75BB91 for ; Thu, 21 Jul 2005 13:51:29 +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 j6LBpTUU008886 for ; Thu, 21 Jul 2005 13:51:29 +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 NAA00390 for ; Thu, 21 Jul 2005 13:51:28 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6LBpRLs009856 for ; Thu, 21 Jul 2005 13:51:28 +0200 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j6LBpOBl016568; Thu, 21 Jul 2005 20:51:26 +0900 (JST) Date: Thu, 21 Jul 2005 20:51:20 +0900 (JST) Message-Id: <20050721.205120.112787682.garrigue@math.nagoya-u.ac.jp> To: malc@pulsesoft.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] A pair of "Interfacing with C" questions From: Jacques Garrigue In-Reply-To: References: <42DF2A64.4000600@rftp.com> <20050721.192154.31710299.garrigue@math.nagoya-u.ac.jp> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 42DF8C41.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42DF8C3F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 interfacing:01 malc:01 malc:01 pulsesoft:01 nativeint:01 mlvalues:01 nativeint:01 pointer:01 sizeof:01 sizeof:01 aargh:01 ocaml:01 casts: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.0 required=5.0 tests=none autolearn=disabled version=3.0.3 From: malc > >> 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. Aargh, they seem to like to break everything! Anyway, I suppose it just means that ocaml would have to define value as a long long int on Win64, to make it behave like other architectures. The sources are full of casts from value to (value *) and back. Rather, this is going to be a pain to port many C libraries, that assume that you can convert between a long and a pointer and back. Jacques Garrigue