summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0455.md
blob: 437dacaff22ec4c027dfab0b5c7709f7d91ad0f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Some linking kinds are target-specific and not supported on all platforms.

Linking with `kind=framework` is only supported when targeting macOS,
as frameworks are specific to that operating system.

Similarly, `kind=raw-dylib` is only supported when targeting Windows-like
platforms.

Erroneous code example:

```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos)
#[link(name = "FooCoreServices", kind = "framework")] extern "C" {}
// OS used to compile is Linux for example
```

To solve this error you can use conditional compilation:

```
#[cfg_attr(target="macos", link(name = "FooCoreServices", kind = "framework"))]
extern "C" {}
```

Learn more in the [Conditional Compilation][conditional-compilation] section
of the Reference.

[conditional-compilation]: https://doc.rust-lang.org/reference/attributes.html#conditional-compilation