# E4156

extern "A" is unsupported in B backend.

This error happens when an FFI function written for a specific backend is
discovered during the compilation of a different backend.

## Erroneous example

```{literalinclude} /sources/error_codes/4156_error/top.mbt
:language: moonbit
```

## Suggestion

You can use conditional compilation to control when the function is available.

- If you want a file level conditional compilation, configure the
  [targets](/toolchain/moon/package.md#conditional-compilation) field.

  ```{literalinclude} /sources/error_codes/4156_fixed/moon.pkg.json
  :caption: moon.pkg.json
  ```
  ```{literalinclude} /sources/error_codes/4156_fixed/top.mbt
  :language: moonbit
  :caption: top.mbt
  ```

- If you want a function level conditional compilation, add the cfg attribute.

  ```{literalinclude} /sources/error_codes/4156_fixed/other.mbt
  :language: moonbit
  :caption: other.mbt
  ```
