Version française
Home     About     Download     Resources     Contact us    
Browse thread
Unsigned int ?!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Luc MAZARDO <Luc.Mazardo@c...>
Subject: Unsigned int ?!

I would like to get the "caml unsigned int value" of an "unsigned int C
value". Is there a way to do this ??

I do the following, and it fails ...


---toto_stub.c---
value toto(void)
{
  return Val_int(get()); 
}
------------

---toto.mli---
val toto : unit -> int ;;
------------

---toto.ml---
external toto : unit -> int = "toto";;
-------------

---test.c---
<<some stuff>>

printf("%d\n", toto()); /* unsigned int: --> 3 */

<<some stuff>>
-----------


---test.ml---
let t = toto () ;;
val t : int = -924646501 /* uh ?? */
-------------


-- 
Luc Mazardo
http://OCamlSDL.sourceforge.net
Gnu Emacs:flame.el Don't you realise that Michael Jackson is a cool
dude?