Does anyone know how I can get a module to be auto-opened by the
compiler, in the same vein as Pervasives? I would very much prefer not
having to tweak around the source code of ocamlc for this purpose.
Thanks,
David
--
David Teller-Rajchenbach
Security of Distributed Systems
http://www.univ-orleans.fr/lifo/Members/David.Teller
Angry researcher: French Universities need reforms, but the LRU act brings liquidations.
_______________________________________________
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
Thanks,
David
I guess you could try and make your own stdlib directory, and then call
ocamlc using:
ocamlc -nostdlib -I mystdlib
or something like that...
--
Romain Bardou
On Mon, 2008-09-08 at 12:04 +0200, Romain Bardou wrote:
> I guess you could try and make your own stdlib directory, and then
> call
> ocamlc using:
>
> ocamlc -nostdlib -I mystdlib
>
> or something like that...
>
--
David Teller-Rajchenbach
Security of Distributed Systems
http://www.univ-orleans.fr/lifo/Members/David.Teller
Angry researcher: French Universities need reforms, but the LRU act
brings liquidations.
_______________________________________________
My guess is that it would try to open mystdlib/Pervasives.cmo...
In other word it's as if you changed your "official"
stdlib/Pervasives.cmo except that it's cleanier as you don't actually
override it (which would change your Pervasives for all your projects).
I didn't try it though, so maybe I'm missing something.
Another way to automatically open your module would be to do a weird
Makefile such as:
%.cmo: %.ml
echo "open Myperv;;\n" > $*.temp.ml
cat $*.ml >> $*.temp.ml
ocamlc -c $*.temp.ml -o $*.cmo
rm $*.temp.ml
Or you could do this using some Ocamlbuild plug-in, or just by using the
-ocamlc option of Ocamlbuild...
Basically, just use any hack which can replace your ocamlc by a script
which adds "open Myperv;;\n" before calling ocamlc ^^
--
Romain Bardou
Well, I did :)
Technically, it fails because you have to name your new module
Pervasives and thus cause a conflict with the original Pervasives.
> Basically, just use any hack which can replace your ocamlc by a script
> which adds "open Myperv;;\n" before calling ocamlc ^^
Yes, that's the kind of things I have in mind.
Unfortunately, it seems that ocamlc only supports one "-pp" tag. So if I
use a simple "-pp 'cat myprefix.ml'", I become incompatible with
Camlp4 :/
Any other idea?
Cheers,
David
--
David Teller-Rajchenbach
Security of Distributed Systems
http://www.univ-orleans.fr/lifo/Members/David.Teller
Angry researcher: French Universities need reforms, but the LRU act brings liquidations.
_______________________________________________