Skip to content

Commit 911e22b

Browse files
authored
Rollup merge of #87315 - ricobbe:raw-dylib-unstable-book, r=wesleywiser
Add docs for raw-dylib to unstable book
2 parents aea2e44 + 8e84e4d commit 911e22b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# `raw_dylib`
2+
3+
The tracking issue for this feature is: [#58713]
4+
5+
[#58713]: https://github.com/rust-lang/rust/issues/58713
6+
7+
------------------------
8+
9+
The `raw_dylib` feature allows you to link against the implementations of functions in an `extern`
10+
block without, on Windows, linking against an import library.
11+
12+
```rust,ignore (partial-example)
13+
#![feature(raw_dylib)]
14+
15+
#[link(name="library", kind="raw-dylib")]
16+
extern {
17+
fn extern_function(x: i32);
18+
}
19+
20+
fn main() {
21+
unsafe {
22+
extern_function(14);
23+
}
24+
}
25+
```
26+
27+
## Limitations
28+
29+
Currently, this feature is only supported on `-windows-msvc` targets. Non-Windows platforms don't have import
30+
libraries, and an incompatibility between LLVM and the BFD linker means that it is not currently supported on
31+
`-windows-gnu` targets.
32+
33+
On the `i686-pc-windows-msvc` target, this feature supports only the `cdecl`, `stdcall`, `system`, and `fastcall`
34+
calling conventions.

0 commit comments

Comments
 (0)