@@ -110,17 +110,24 @@ The following [attributes] control the behavior of external blocks.
110110### The ` link ` attribute
111111
112112The * ` link ` attribute* specifies the name of a native library that the
113- compiler should link with. It uses the [ _ MetaListNameValueStr _ ] syntax to
114- specify its inputs. The ` name ` key is the name of the native library to link.
115- The ` kind ` key is an optional value which specifies the kind of library with
116- the following possible values:
113+ compiler should link with for the items within an ` extern ` block . It uses the
114+ [ _ MetaListNameValueStr _ ] syntax to specify its inputs. The ` name ` key is the
115+ name of the native library to link. The ` kind ` key is an optional value which
116+ specifies the kind of library with the following possible values:
117117
118118- ` dylib ` — Indicates a dynamic library. This is the default if ` kind ` is not
119119 specified.
120120- ` static ` — Indicates a static library.
121121- ` framework ` — Indicates a macOS framework. This is only valid for macOS
122122 targets.
123123
124+ The ` name ` key must be included if ` kind ` is specified.
125+
126+ The ` wasm_import_module ` key may be used to specify the [ WebAssembly module]
127+ name for the items within an ` extern ` block when importing symbols from the
128+ host environment. The default module name is ` env ` if ` wasm_import_module ` is
129+ not specified.
130+
124131``` rust,ignore
125132#[link(name = "crypto")]
126133extern {
@@ -131,6 +138,11 @@ extern {
131138extern {
132139 // …
133140}
141+
142+ #[link(wasm_import_module = "foo")]
143+ extern {
144+ // …
145+ }
134146```
135147
136148It is valid to add the ` link ` attribute on an empty extern block. You can use
@@ -152,6 +164,7 @@ extern {
152164```
153165
154166[ IDENTIFIER ] : identifiers.html
167+ [ WebAssembly module ] : https://webassembly.github.io/spec/core/syntax/modules.html
155168[ _Abi_ ] : items/functions.html
156169[ _FunctionParam_ ] : items/functions.html
157170[ _FunctionParameters_ ] : items/functions.html
0 commit comments