Erik de Castro Lopo wrote:
> b) caml_copy_nativeint creates a boxed native int (either Int32.t
>or Int64.t) not an unboxed Ocaml int. To create an unboxed
>Ocaml int, Val_int() is the correct macro.
>
caml_copy_nativeint returns a element of the OCaml type 'nativeint':
http://caml.inri
Erik de Castro Lopo wrote:
> This is strange, it wasn't declared with a CAMLlocal macro and it
> was working, but if I do declare it with one the program segfaults
> during garbage collection (caml_oldify_local_roots).
Ok, with the help of someone off list I've sorted this out to
my satisfaction.
malc wrote:
> On Tue, 9 Aug 2011, David Allsopp wrote:
>
> > Erik de Castro Lopo wrote:
> > > Xavier Leroy wrote:
> > >
> > > > On 08/08/2011 10:03 AM, Guillaume Yziquel wrote:
> > > >
> > > > > Then I do not see anything wrong if the code snippet you sent.
> > > > > However, when you change Val_i
On Tue, 9 Aug 2011, David Allsopp wrote:
> Erik de Castro Lopo wrote:
> > Xavier Leroy wrote:
> >
> > > On 08/08/2011 10:03 AM, Guillaume Yziquel wrote:
> > >
> > > > Then I do not see anything wrong if the code snippet you sent.
> > > > However, when you change Val_int to caml_copy_nativeint, th
Erik de Castro Lopo wrote:
> Xavier Leroy wrote:
>
> > On 08/08/2011 10:03 AM, Guillaume Yziquel wrote:
> >
> > > Then I do not see anything wrong if the code snippet you sent.
> > > However, when you change Val_int to caml_copy_nativeint, the layout
> > > of the tuple is different. [...] So if yo
2011/8/8 Erik de Castro Lopo :
> Xavier Leroy wrote:
>
>> On 08/08/2011 10:03 AM, Guillaume Yziquel wrote:
>>
>> > Then I do not see anything wrong if the code snippet you sent. However,
>> > when you change Val_int to caml_copy_nativeint, the layout of the tuple
>> > is different. [...] So if you
Xavier Leroy wrote:
> On 08/08/2011 10:03 AM, Guillaume Yziquel wrote:
>
> > Then I do not see anything wrong if the code snippet you sent. However,
> > when you change Val_int to caml_copy_nativeint, the layout of the tuple
> > is different. [...] So if you keep the same OCaml code when reading
On 08/08/2011 10:03 AM, Guillaume Yziquel wrote:
> Then I do not see anything wrong if the code snippet you sent. However,
> when you change Val_int to caml_copy_nativeint, the layout of the tuple
> is different. [...] So if you keep the same OCaml code when reading
> the result value, it's no sur
Le lundi 08 août 2011 à 10:03 +0200, Guillaume Yziquel a écrit :
> With Val_int, you have an integral value in the tuple's field.
>
> With caml_copy_nativeint, you have a pointer in the tuple's field.
More explicitly, Val_int creates you a value of type int in the OCaml
world, while caml_copy_nat
Le Monday 08 Aug 2011 à 17:46:19 (+1000), Erik de Castro Lopo a écrit :
> Guillaume Yziquel wrote:
>
> > What do you mean by "doesn't work" precisely?
>
> The integer value I assign in the C file (and print out for a
> sanity check) ends up as what looks like an address in the
> Ocaml code.
>
>
Guillaume Yziquel wrote:
> Given that Val_int is Val_long (in mlvalues.h):
>
> #define Val_int(x) Val_long(x)
>
> it's not an issue with this piece of code.
>
> But depending on what "doesn't work" means and on the declarations of
> width and height, then sizeof(int) < sizeof(long) may ex
Guillaume Yziquel wrote:
> What do you mean by "doesn't work" precisely?
The integer value I assign in the C file (and print out for a
sanity check) ends up as what looks like an address in the
Ocaml code.
Erik
--
--
Erik de C
On Mon, 8 Aug 2011, Guillaume Yziquel wrote:
> Le Monday 08 Aug 2011 ? 09:20:17 (+0400), malc a ?crit :
> > On Mon, 8 Aug 2011, Erik de Castro Lopo wrote:
> >
> > > Hi all,
> > >
> > > I'm writing a C stub function to allow the calling of a C library
> > > function from ocaml. The return from th
Le Monday 08 Aug 2011 à 09:20:17 (+0400), malc a écrit :
> On Mon, 8 Aug 2011, Erik de Castro Lopo wrote:
>
> > Hi all,
> >
> > I'm writing a C stub function to allow the calling of a C library
> > function from ocaml. The return from the stub is a tuple and I'm
> > doing this:
> >
> > /* Pa
On Mon, 8 Aug 2011, Erik de Castro Lopo wrote:
> Hi all,
>
> I'm writing a C stub function to allow the calling of a C library
> function from ocaml. The return from the stub is a tuple and I'm
> doing this:
>
> /* Package up the result as a tuple. */
> v_response = caml_alloc_tuple (3)
Le Sunday 07 Aug 2011 à 22:48:08 (-0500), Romain Beauxis a écrit :
> 2011/8/7 Erik de Castro Lopo :
> > Hi all,
>
> Hi,
>
> > I'm writing a C stub function to allow the calling of a C library
> > function from ocaml. The return from the stub is a tuple and I'm
> > doing this:
> >
> > /* Packag
Le Monday 08 Aug 2011 à 13:15:04 (+1000), Erik de Castro Lopo a écrit :
> Hi all,
>
> I'm writing a C stub function to allow the calling of a C library
> function from ocaml. The return from the stub is a tuple and I'm
> doing this:
>
> /* Package up the result as a tuple. */
> v_response
2011/8/7 Erik de Castro Lopo :
> Hi all,
Hi,
> I'm writing a C stub function to allow the calling of a C library
> function from ocaml. The return from the stub is a tuple and I'm
> doing this:
>
> /* Package up the result as a tuple. */
> v_response = caml_alloc_tuple (3) ;
>
> Store_fi
18 matches
Mail list logo