# Functor inlining in public library

I’m using capnp for some internal messaging in a library. However in the generated code a functor is exposed:

``````module Make(M:Capnp.MessageSig.S) = MakeRPC[@inlined](Capnp.RPC.None(M)) [@@inline]
``````

This then is throwing the warning:

``````Cannot inline: Function information unavailable
``````

From what I know I think this is getting thrown because the functor is exposed to potentially any `M` getting passed in thus it doesn’t know what the `M` will take thus it can’t inline it.

I’d expect that what I want to do is to just not expose this module, however I can’t see quite how to do that. I’ve poked at the `private_modules` field in the `dune` file however that doesn’t seem to have had any effect.

`(flags :standard -w -55)` might do it.

The inlining annotations that capnp produces are really intended for flambda and should probably be disabled on normal builds.

1 Like

Ah that makes sense. I take it that I should probably then be building this with flambda?

Maybe, if you really care about speed.

I added these annotations because I wanted to switch capnp to use jbuilder and get rid of camlp4, and without the annotations that change made the benchmarks slower (see https://github.com/capnproto/capnp-ocaml/pull/22 and https://github.com/capnproto/capnp-ocaml/pull/23).

1 Like