README.OpenSource
1[
2 {
3 "Name": "link-cplusplus",
4 "License": "Apache License V2.0, MIT",
5 "License File": "LICENSE-APACHE, LICENSE-MIT",
6 "Version Number": "v1.0.8",
7 "Owner": "fangting12@huawei.com",
8 "Upstream URL": "https://github.com/dtolnay/link-cplusplus",
9 "Description": "A Rust library that provides support for linking with C++ code."
10 }
11]
12
README.md
1`-lstdc++` or `-lc++`
2=====================
3
4[<img alt="github" src="https://img.shields.io/badge/github-dtolnay/link--cplusplus-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/link-cplusplus)
5[<img alt="crates.io" src="https://img.shields.io/crates/v/link-cplusplus.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/link-cplusplus)
6[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-link--cplusplus-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20">](https://docs.rs/link-cplusplus)
7[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/dtolnay/link-cplusplus/ci.yml?branch=master&style=for-the-badge" height="20">](https://github.com/dtolnay/link-cplusplus/actions?query=branch%3Amaster)
8
9This crate exists for the purpose of passing `-lstdc++` or `-lc++` to the
10linker, while making it possible for an application to make that choice on
11behalf of its library dependencies.
12
13Without this crate, a library would need to:
14
15- pick one or the other to link, with no way for downstream applications to
16 override the choice;
17- or link neither and require an explicit link flag provided by downstream
18 applications even if they would be fine with a default choice;
19
20neither of which are good experiences.
21
22<br>
23
24## Options
25
26An application or library that is fine with either of libstdc++ or libc++ being
27linked, whichever is the platform's default, should use the following in
28Cargo.toml:
29
30```toml
31[dependencies]
32link-cplusplus = "1.0"
33```
34
35An application that wants a particular one or the other linked should use:
36
37```toml
38[dependencies]
39link-cplusplus = { version = "1.0", features = ["libstdc++"] }
40
41# or
42
43link-cplusplus = { version = "1.0", features = ["libc++"] }
44```
45
46An application that wants to handle its own more complicated logic for link
47flags from its build script can make this crate do nothing by using:
48
49```toml
50[dependencies]
51link-cplusplus = { version = "1.0", features = ["nothing"] }
52```
53
54Lastly, make sure to add an explicit `extern crate` dependency to your crate
55root, since the link-cplusplus crate will be otherwise unused and its link flags
56dropped.
57
58```rust
59// src/lib.rs
60
61extern crate link_cplusplus;
62```
63
64<br>
65
66#### License
67
68<sup>
69Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
702.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
71</sup>
72
73<br>
74
75<sub>
76Unless you explicitly state otherwise, any contribution intentionally submitted
77for inclusion in this project by you, as defined in the Apache-2.0 license,
78shall be dual licensed as above, without any additional terms or conditions.
79</sub>
80