I have a problem with ppx rewriters. In there repo you can find
-
lib/libmainwhich is a library with logic of rewriter -
lib/libpluginwhich is a dynamically loadable plugin for lib/libmain -
lib/ppxmainwhich is actual ppx rewriter that uses lib/libmain. It may use lib/libplugin, but indirectly - ./main is an executable which is going to preprocess using PPX where rewriter is being built from
lib/libmain,lib/libpluginandlib/ppxmain.
The problem. If I write (preprocess (pps ppxmain)) then I’m not linking a plugin, which is not what I want. I don’t know how to specify all three libbraries using (preprocess (pps ...)) dune stanza.
What I tried:
- I added
(kind ppx_rewriter)to all three libraries but dune complained that some of them seems not to be actual rewriters. - I tried to specify all three libraries like
(pps libmain libplugin ppxmain)but dune complains that some of them aren’t rewriters, and dune is right about that.
Current workaround: create a custom executable which will link all the stuff together using -linkall flag and use it as a custom rewriter.
P.S. I found a manual section about dynamically loading of findlib packages but I’m not sure that this is really related to the topic