From 3808abe60e34c61b46b7b5a3343c093765b62efe Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 11 Jan 2021 15:44:57 -0800 Subject: [PATCH] Document extern crate link_cplusplus; --- README.md | 13 ++++++++++++- src/lib.rs | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6ad4221..be4435b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ neither of which are good experiences. ## Options An application or library that is fine with either of libstdc++ or libc++ being -linked, whichever is the platform's default, should use: +linked, whichever is the platform's default, should use the following in +Cargo.toml: ```toml [dependencies] @@ -50,6 +51,16 @@ flags from its build script can make this crate do nothing by using: link-cplusplus = { version = "1.0", features = ["nothing"] } ``` +Lastly, make sure to add an explicit `extern crate` dependency to your crate +root, since the link-cplusplus crate will be otherwise unused and its link flags +dropped. + +```rust +// src/lib.rs + +extern crate link_cplusplus; +``` +
#### License diff --git a/src/lib.rs b/src/lib.rs index f2290be..33d0a34 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,8 @@ //! # Options //! //! An application or library that is fine with either of libstdc++ or libc++ -//! being linked, whichever is the platform's default, should use: +//! being linked, whichever is the platform's default, should use the following +//! in Cargo.toml: //! //! ```toml //! [dependencies] @@ -51,3 +52,13 @@ //! [dependencies] //! link-cplusplus = { version = "1.0", features = ["nothing"] } //! ``` +//! +//! Lastly, make sure to add an explicit `extern crate` dependency to your crate +//! root, since the link-cplusplus crate will be otherwise unused and its link +//! flags dropped. +//! +//! ``` +//! // src/lib.rs +//! +//! extern crate link_cplusplus; +//! ```