Using ppx with ocamlc directly

Hey there

Im trying to run a ppx directly with ocamlc not using dune.
just -ppx [name_of_ppx] doesnt work.
I searched for quite a while now and didnt realy find an explenation of how to correctly use the -ppx attribute.

it’s ... -ppx "the_ppx_library/ppx.exe -as-ppx" ...
see here

also:
If you look at the help message: ocamlc -help
you get back a description of how it works:
-ppx <command> Pipe abstract syntax trees through preprocessor <command>
which implies you need a standalone ppx command to pipe the program ast through.

The manual page also expands on the brief help message:

...
       -ppx command
              After  parsing,  pipe  the  abstract syntax tree through the pre‐
              processor command.  The module Ast_mapper(3) implements  the  ex‐
              ternal interface of a preprocessor.
...
1 Like