Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Brian Hurt <bhurt@spnz.org>
To: Jonathan Bryant <jtbryant@valdosta.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Primitive sizes
Date: Thu, 30 Sep 2004 15:54:33 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0409301551020.5809-100000@localhost.localdomain> (raw)
In-Reply-To: <1096525010.29339.5.camel@localhost>

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


  reply	other threads:[~2004-09-30 20:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29  6:43 Jonathan Bryant
2004-09-29 15:02 ` Brian Hurt
2004-09-30  6:16   ` Jonathan Bryant
2004-09-30 20:54     ` Brian Hurt [this message]
2004-10-01  9:36       ` Richard Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0409301551020.5809-100000@localhost.localdomain \
    --to=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    --cc=jtbryant@valdosta.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox