Version française
Home     About     Download     Resources     Contact us    
Browse thread
C interface style question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Florent Monnier <fmonnier@l...>
Subject: Re: [Caml-list] C interface style question
> > > > value-type parameters to C functions exported to OCaml should be
> > > > registered with CAMLparamX(...). Does this hold in general, or is it
> > > > considered acceptable/appropriate to just ignore this for "immediate"
> > > > values that do not hold pointers, but, say, int, bool etc. values?
> > >
> > > If you don't allocate O'Caml memory you need not to register the
> > > parameters.
> >
> > And in this case there's no need to use CAMLreturn(), return is enough,
> > is it right ?
>
> That would not even compile without a CAMLparam.

Most of the LablGL functions have no CAMLparam and no CAMLreturn.
Here is just an exemple:

CAMLprim value
ml_glDeleteTexture (value texture_id)
{
    GLuint id = Int32_val(texture_id);
    glDeleteTextures(1, &id);
    return Val_unit;
}

And I think the author does know his way around OCaml tricks

-- 
Regards