From 9b7521314705fdfcc3f459a2f7d09090ad39b05c Mon Sep 17 00:00:00 2001 From: Richard Cobbe Date: Mon, 19 Jul 2021 17:51:49 -0700 Subject: [PATCH 1/3] Add docs for raw-dylib to unstable book --- .../src/language-features/raw-dylib.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/raw-dylib.md diff --git a/src/doc/unstable-book/src/language-features/raw-dylib.md b/src/doc/unstable-book/src/language-features/raw-dylib.md new file mode 100644 index 0000000000000..38a3cfd4d61ce --- /dev/null +++ b/src/doc/unstable-book/src/language-features/raw-dylib.md @@ -0,0 +1,34 @@ +# `raw_dylib` + +The tracking issue for this feature is: [#58713] + +[#58713]: https://github.com/rust-lang/rust/issues/58713 + +------------------------ + +The `raw_dylib` feature allows you to link against the implementations of functions in an `extern` +block without, on Windows, linking against an import library. + +```rust +#![feature(raw_dylib)] + +#[link(name="library", kind="raw-dylib")] +extern { + fn extern_function(x: i32); +} + +fn main() { + unsafe { + extern_function(14); + } +} +``` + +## Limitations + +Currently, this feature is only supported on `-windows-msvc` targets. Non-Windows platforms don't have import +libraries, and an incompatibility between LLVM and the BFD linker means that it is not currently supported on +`-windows-gnu` targets. + +On the `i686-pc-windows-msvc` target, this feature supports only the `cdecl`, `stdcall`, `system`, and `fastcall` +calling conventions. From 3061b9bda8ac136396d5f938ed05e0d25a16e0f0 Mon Sep 17 00:00:00 2001 From: Richard Cobbe Date: Tue, 20 Jul 2021 12:45:20 -0700 Subject: [PATCH 2/3] Ignore example in automation --- src/doc/unstable-book/src/language-features/raw-dylib.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/unstable-book/src/language-features/raw-dylib.md b/src/doc/unstable-book/src/language-features/raw-dylib.md index 38a3cfd4d61ce..01cbe2e786f09 100644 --- a/src/doc/unstable-book/src/language-features/raw-dylib.md +++ b/src/doc/unstable-book/src/language-features/raw-dylib.md @@ -9,7 +9,8 @@ The tracking issue for this feature is: [#58713] The `raw_dylib` feature allows you to link against the implementations of functions in an `extern` block without, on Windows, linking against an import library. -```rust + +```rust,ignore #![feature(raw_dylib)] #[link(name="library", kind="raw-dylib")] From 8e84e4d8e1af2e87e37156b28020e110714e1a29 Mon Sep 17 00:00:00 2001 From: Richard Cobbe Date: Tue, 20 Jul 2021 14:04:38 -0700 Subject: [PATCH 3/3] Fix ignore annotation --- src/doc/unstable-book/src/language-features/raw-dylib.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/doc/unstable-book/src/language-features/raw-dylib.md b/src/doc/unstable-book/src/language-features/raw-dylib.md index 01cbe2e786f09..23fc5b3052d8d 100644 --- a/src/doc/unstable-book/src/language-features/raw-dylib.md +++ b/src/doc/unstable-book/src/language-features/raw-dylib.md @@ -9,8 +9,7 @@ The tracking issue for this feature is: [#58713] The `raw_dylib` feature allows you to link against the implementations of functions in an `extern` block without, on Windows, linking against an import library. - -```rust,ignore +```rust,ignore (partial-example) #![feature(raw_dylib)] #[link(name="library", kind="raw-dylib")]