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 34E8FBDCB for ; Thu, 8 Sep 2005 19:42:29 +0200 (CEST) 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 j88HgS7h003959 for ; Thu, 8 Sep 2005 19:42:28 +0200 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 TAA09844 for ; Thu, 8 Sep 2005 19:42:28 +0200 (MET DST) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j88HgRZr003956 for ; Thu, 8 Sep 2005 19:42:27 +0200 Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id 82818CCF398; Thu, 8 Sep 2005 13:42:26 -0400 (EDT) Received: from frontend3.messagingengine.com ([10.202.2.152]) by frontend1.internal (MEProxy); Thu, 08 Sep 2005 13:42:26 -0400 X-Sasl-enc: 7uCWanqGOT3QVPwz0FcA2YUXT0lyCLqqX2yCcD0SAwbH 1126201346 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by frontend3.messagingengine.com (Postfix) with ESMTP id 569C71DA; Thu, 8 Sep 2005 13:42:26 -0400 (EDT) Date: Thu, 8 Sep 2005 10:41:31 -0700 (PDT) From: Martin Jambon X-X-Sender: martin@droopy To: Christophe Raffalli Cc: caml-list Subject: Re: [Caml-list] camlp4 question In-Reply-To: <431FF009.9050608@univ-savoie.fr> Message-ID: References: <431FF009.9050608@univ-savoie.fr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 43207804.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43207803.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 christophe:01 raffalli:01 lablglut:01 ocamlc:01 ocamlopt:01 ocamlc:01 lablglut:01 printf:01 printf:01 caml-list:01 beginner's:01 ocaml:01 beginners:01 bug: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.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Thu, 8 Sep 2005, Christophe Raffalli wrote: > I am writing a tool to facilitate the use of callback of camlfunction from C. > I have a first prototype running for lablGlut, but I want to make it nicer > using camlp4 (this extension should produce automatically the C wrapper for > each callback, the user will only have to compile the produced C file). > > The pb is that I need to retrieve information given in one module from > another. The minimum I need to do is to search for the path given to ocamlc > (the -I options) from camlp4 code, but I would prefer a better way, and I do > not know how to retrive this PATH anyway. Maybe write a script which would transmit the -I options to camlp4o and to ocamlopt/ocamlc (each camlp4 loadable module can define additional options to pass to camlp4/camlp4o) Martin > > Here is an example to illustrate what I need (the type 'a callback is a type > to a C wrapper for a function of type 'a) : > > -- file glut.ml, part of the lablGlut library -- > > ... > > let visibility_state_of_int = function > 0 -> NOT_VISIBLE > | 1 -> VISIBLE > | _ -> raise (BadEnum "visibility_state") > > REGISTER_CONVERSION visibility_state_of_int > > external visibilityFunc : > cb:(state:visibility_state_t->unit) callback->unit > = "ml_glutVisibilityFunc" > > ... > > -- file test.ml an example using lablGlut -- > > open Glut > > ... > > let state_changed ~state = > match value with > NOT_VISIBLE -> printf "window not visible."; print_newline() > | VISIBLE -> printf "window not visible."; print_newline() > > MAKE_WRAPPER state_changed state_changed_cb > (* here I need to search for the convertion for the type > visibility_state_of_int which was defined in glut.ml to make the > C wrapper state_changed_cb : (visibility_state_of_int -> unit) callback *) > > let _ = Glut.visibilityFunc state_changed_cb > > ... > > Can someone help ? > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Martin Jambon, PhD http://martin.jambon.free.fr