From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id AB5BDBB9C for ; Thu, 19 Jan 2006 01:07:48 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k0J07mPK016547 for ; Thu, 19 Jan 2006 01:07:48 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA28207 for ; Thu, 19 Jan 2006 01:07:47 +0100 (MET) Received: from smtp114.sbc.mail.mud.yahoo.com (smtp114.sbc.mail.mud.yahoo.com [68.142.198.213]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id k0J07k3g016541 for ; Thu, 19 Jan 2006 01:07:46 +0100 Received: (qmail 50118 invoked from network); 18 Jan 2006 23:42:26 -0000 Received: from unknown (HELO ?192.168.1.100?) (rftp@pacbell.net@69.230.226.66 with plain) by smtp114.sbc.mail.mud.yahoo.com with SMTP; 18 Jan 2006 23:42:26 -0000 Message-ID: <43CED284.3010904@rftp.com> Date: Wed, 18 Jan 2006 15:43:00 -0800 From: Robert Roessler User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060118 SeaMonkey/1.5a MIME-Version: 1.0 To: Caml-list Subject: Re: [Caml-list] C interface style question References: <200601182132.45196.fmonnier@linux-nantes.fr.eu.org> <1137619863.11593.107.camel@localhost.localdomain> <200601190021.11934.fmonnier@linux-nantes.fr.eu.org> In-Reply-To: <200601190021.11934.fmonnier@linux-nantes.fr.eu.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 43CED854.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43CED852.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 pointers:01 bool:01 o'caml:01 camlreturn:01 camlparam:01 lablgl:01 camlparam:01 camlreturn:01 camlprim:01 val:01 val:01 ocaml:01 arity:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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