# Using \`\[@inlined\]\` attribute with \`dune\`

**URL:** <https://discuss.ocaml.org/t/using-inlined-attribute-with-dune/15205>\
**Category:** Community\
**Tags:** dune\
**Created:** [August 27, 2024, 9:36am UTC](https://discuss.ocaml.org/t/using-inlined-attribute-with-dune/15205 "2024-08-27T09:36:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![esope](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/esope/32/2982_2.png) [@esope](https://discuss.ocaml.org/u/esope)\
**Post date:** [August 27, 2024, 9:36am UTC](https://discuss.ocaml.org/t/using-inlined-attribute-with-dune/15205/1 "2024-08-27T09:36:00Z")

</div>

Hi there,

I am wondering how to use the `[@inlined]` attribute (that checks that a function call is inlined by the compiler) with `dune`. It seems that the `dev` profile of `dune` inhibits cross-module function inlining completely.

Here is an example.

File `a.ml` contains

```ocaml
let[@inline] f x = x

```

and file `b.ml` contains

```ocaml
let x = (A.f[@inlined]) 42

```

When I build the project with the `release` profile using `dune build --profile release` everything works fine: no warning is emitted, which means that the call to `A.f` is effectively inlined.

However, with the `dev` profile (which is the default) the warning 55 is triggered:

```console
$ dune build
File "b.ml", line 1, characters 8-26:
1 | let x = (A.f[@inlined]) 42
            ^^^^^^^^^^^^^^^^^^
Error (warning 55 [inlining-impossible]): Cannot inline: Unknown function

```

Should warning 55 be turned off by default in dev profile?  
Do you have any other suggestion? Or am I missing something?

EDIT: I have just noticed there is [an open issue in dune](https://github.com/ocaml/dune/issues/4123) related to this problem.

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [August 27, 2024, 9:56am UTC](https://discuss.ocaml.org/t/using-inlined-attribute-with-dune/15205/2 "2024-08-27T09:56:03Z")

</div>

> [@esope](#):
>
> Should warning 55 be turned off by default in dev profile?

I think this is a reasonable suggestion; it would be good to mention it in the Dune bugtracker.

Cheers,  
Nicolas
