Browse thread
C interface style question
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Robert Roessler <roessler@r...> |
| Subject: | Re: [Caml-list] C interface style question |
Florent Monnier wrote:
>>>>> 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
I think Gerd's point was regarding the CAMLreturn... *that* will not
compile without the function having a CAMLparam of some "arity"
present. ;)
Robert Roessler
roessler@rftp.com
http://www.rftp.com