From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 13EBABB81 for ; Fri, 22 Jul 2005 11:31:33 +0200 (CEST) Received: from kvi.nl (KVIS12.KVI.nl [129.125.27.62]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6M9VWqx030551 (version=TLSv1/SSLv3 cipher=DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 22 Jul 2005 11:31:32 +0200 Received: from KVIR52.KVI.nl ([129.125.37.116] verified) by kvi.nl (CommuniGate Pro SMTP 4.3.2) with ESMTP id 2515547 for caml-list@yquem.inria.fr; Fri, 22 Jul 2005 11:31:31 +0200 Received: from kvis12.kvi.nl by KVIR52.KVI.nl (AvMailGate-2.0.2-15) id 05682-6929247A; Fri, 22 Jul 2005 11:31:31 +0200 Received: by kvis12.kvi.nl (Postfix, from userid 0) id A4772C40BB; Fri, 22 Jul 2005 11:31:31 +0200 (CEST) Received: from [81.69.122.212] (account usov HELO kvip55) by kvi.nl (CommuniGate Pro SMTP 4.3.2) with ESMTPA id 2515546 for caml-list@yquem.inria.fr; Fri, 22 Jul 2005 11:31:31 +0200 From: "Alexander S. Usov" Organization: KVI To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] A pair of "Interfacing with C" questions Date: Fri, 22 Jul 2005 11:31:27 +0200 User-Agent: KMail/1.8.1 References: <42DF2A64.4000600@rftp.com> <20050721.205120.112787682.garrigue@math.nagoya-u.ac.jp> <42E08396.4040502@rftp.com> In-Reply-To: <42E08396.4040502@rftp.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200507221131.27579.A.S.Usov@kvi.nl> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-AntiVirus: checked by AntiVir MailGate (version: 2.0.2-15; AVE: 6.31.1.0; VDF: 6.31.1.10; host: kvi.nl) X-Miltered: at concorde with ID 42E0BCF4.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.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Friday 22 July 2005 07:26, Robert Roessler wrote: > Jacques Garrigue wrote: > > 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. > > I was worried about something like the Win64 silliness... ;) > > Said silliness aside, I will go ahead and switch to nativeint - thanks. According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/abstract_data_models.asp they have chosen LLP64 model, while almost everybody else are using LP64. Quite funny choice I should say. But from the other point of view -- isn't it possible to make the compiler to complain hard when you are trying to convert int/long to pointer? -- Best regards, Alexander.