diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/doc/unstable-book/src/language-features/raw-dylib.md | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/doc/unstable-book/src/language-features/raw-dylib.md')
-rw-r--r-- | src/doc/unstable-book/src/language-features/raw-dylib.md | 34 |
1 files changed, 34 insertions, 0 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 new file mode 100644 index 000000000..23fc5b305 --- /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,ignore (partial-example) +#![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. |