Version française
Home     About     Download     Resources     Contact us    
Browse thread
native values in objects from c
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] native values in objects from c
From: "Michael Wohlwend" <micha-1@fantasymail.de>

> with that code:
> 
> class x = object
>  val name = "hoho"
> end;;
> 
> let ho = new x in ...
> 
> 
> how do I access the field name form C? 
> 
> The docu says it should be the third field of the block, but that doesn't work for me (it has Tag 0, not 252 for strings ...)

Well, since fields start at 0, the 3rd field is number 2.

# Obj.size (Obj.repr ho);;
- : int = 3
# Obj.tag (Obj.field (Obj.repr ho) 2);;                    
- : int = 252

Jacques Garrigue