the toplevel interaction below is:

$ ocamlc -I +camlp4 camlp4lib.cma -pp camlp4orf -c pa_foreach.ml

but I don't iunderstand what you mean by "should be generated through the toplevel itself"

Can you please explain or point me to an existing example ?

Do you want me to add pa_foreach.cmo and link to it ?

Thanks