]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | Linking with `kind=framework` is only supported when targeting macOS, |
2 | as frameworks are specific to that operating system. | |
3 | ||
4 | Erroneous code example: | |
5 | ||
6 | ```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos) | |
7 | #[link(name = "FooCoreServices", kind = "framework")] extern {} | |
8 | // OS used to compile is Linux for example | |
9 | ``` | |
10 | ||
11 | To solve this error you can use conditional compilation: | |
12 | ||
13 | ``` | |
14 | #[cfg_attr(target="macos", link(name = "FooCoreServices", kind = "framework"))] | |
15 | extern {} | |
16 | ``` | |
17 | ||
74b04a01 XL |
18 | Learn more in the [Conditional Compilation][conditional-compilation] section |
19 | of the Reference. | |
20 | ||
21 | [conditional-compilation]: https://doc.rust-lang.org/reference/attributes.html#conditional-compilation |