English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Ocamlbuild plugins
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-05 (20:34)
From: Dario Teixeira <darioteixeira@y...>
Subject: Ocamlbuild plugins

(I sent a similar message to this ocaml-beginner's list, but I have the
feeling this will require the assistance of some heavy-weights...)

First, -- and sorry if the answer is obvious -- I still haven't been able
to find Ocamlbuild's documentation about the construction of plugins.  All
I discovered about Ocamlbuild is a brief presentation, the (incomplete)
user manual, and the wiki, which are found at the following addresses:


Now, the wiki has a few example plugins, and I've tried to dissect
them, but I still have this nagging feeling there must be somewhere
some documentation that introduces how these plugins work.  I've been
cursing at google for a while now, so I am asking directly on this
list -- where are those missing pieces?  (It's okay if they're not
in English)

Anyway, what I intend to do is actually very simple.  In "classic"
makefile notation it is expressed as follows:  (note the use of findlib)

database.cmo: database.ml
        PGDATABASE=lambdium ocamlfind ocamlc -package
threads,pgocaml.statements -syntax camlp4o -thread -c $<

So basically I declare an environment variable PGDATABASE, and
invoke the compiler (via findlib) with a Camlp4 preprocessing stage.
(The pgocaml.statements package instructs findlib about the module to
use for Camlp4; the contents of findlib's META file are listed at the
end of this message).

I've been looking at how to encode this in Ocamlbuild but I've tripped
over some basic problems.  First, how are plugins invoked?  Second,
I cannot find the "Ocamlbuild_plugin" module that is opened by all the
examples (I am using GODI).  Third, how do I even start to implement
the Ocamlbuild code to compile the code above?

Thanks in advance for your help!
Dario Teixeira

description="PG'OCaml is a set of OCaml bindings for the PostgreSQL database."

package "statements" (
  requires = "pgocaml,camlp4"
  version = "1.0"
  description = "Syntax extension: PostgreSQL statements checked at
  archive(syntax,preprocessor) = "pa_pgsql.cmo"
  archive(syntax,toploop) = "pa_pgsql.cmo"

Yahoo! Answers - Got a question? Someone out there knows the answer. Try it