Skip to content

Commit

Permalink
Rollup merge of rust-lang#87315 - ricobbe:raw-dylib-unstable-book, r=…
Browse files Browse the repository at this point in the history
…wesleywiser

Add docs for raw-dylib to unstable book
  • Loading branch information
JohnTitor committed Jul 28, 2021
2 parents 609bed8 + 8e84e4d commit e9862fc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/doc/unstable-book/src/language-features/raw-dylib.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit e9862fc

Please sign in to comment.