From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 50BA3BDCB for ; Thu, 8 Sep 2005 10:02:20 +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 j8882JjS003190 for ; Thu, 8 Sep 2005 10:02:20 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA01835 for ; Thu, 8 Sep 2005 10:02:19 +0200 (MET DST) Received: from smtp.cegetel.net (mf00.sitadelle.com [212.94.174.67]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8882Jeb017131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 8 Sep 2005 10:02:19 +0200 Received: from [192.168.144.2] (unknown [84.5.105.41]) by smtp.cegetel.net (Postfix) with ESMTP id 7B9122352DC; Thu, 8 Sep 2005 10:02:18 +0200 (CEST) Message-ID: <431FF009.9050608@univ-savoie.fr> Date: Thu, 08 Sep 2005 10:02:17 +0200 From: Christophe Raffalli User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: fr, en MIME-Version: 1.0 To: caml-list Subject: camlp4 question Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 431FF00B.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 431FF00B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 lablglut:01 ocamlc:01 lablglut:01 printf:01 printf:01 ...:98 ...:98 compile:01 glut:01 glut: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 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. 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 ?