From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA26685; Thu, 30 Sep 2004 22:43:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA13592 for ; Thu, 30 Sep 2004 22:43:52 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8UKhoup003281 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 30 Sep 2004 22:43:52 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.13.1/8.12.11) with ESMTP id i8UKhie4005295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Sep 2004 15:43:47 -0500 (CDT) Date: Thu, 30 Sep 2004 15:54:33 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Jonathan Bryant cc: caml-list@inria.fr Subject: Re: [Caml-list] Primitive sizes In-Reply-To: <1096525010.29339.5.camel@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 415C7006.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 java's:01 char:01 truncate:01 inclined:01 floats:01 floats:01 java's:01 -bit:01 compilers:01 ints:01 ocaml:01 ocaml:01 jvm:01 ocaml-:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 30 Sep 2004, Jonathan Bryant wrote: > Ok. Maybe I need to make clear what I'm doing. I'm trying to write > native Java methods and have them call an OCaml library. The problem is > that I need Java compatible primitives to pass back from the methods. > In Java (ON ALL PLATFORMS), the primitives fall this way (in case you > don't know them off the top of your head): I don't know what Java's calling convention is. My advice: > Type Bits > ----- ---- > byte - 8 > short - 16 > char - 16 > boolean - 8 The above I'd just promote to ints for Ocaml, and truncate as necessary. > int - 32 I'd use Int32's. > long - 64 I'd use Int64's. > float - 32 > double - 64 I'd be inclined to promote both of these to Ocaml floats, which are 64-bit IEEE 754 floats (the same as Java's). The extra precision won't hurt anything except stupidly strict binary compatability. I assume you're using one of the Ocaml->JVM compilers kicking around. Tying Ocaml native mode (or VM) code to Java would be way too much work. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners