mirror of
https://github.com/fluencelabs/gitbook-docs
synced 2025-04-26 00:12:14 +00:00
GitBook: [main] 53 pages modified
This commit is contained in:
parent
170d601cf4
commit
832dfd4c71
@ -60,10 +60,10 @@ The `[marine]` macro can also wrap an [`extern` block](https://doc.rust-lang.org
|
|||||||
* There should be another module, module B, that exports the same functions. The name of module B is indicated in the `link` macro \(see examples below\).
|
* There should be another module, module B, that exports the same functions. The name of module B is indicated in the `link` macro \(see examples below\).
|
||||||
* Module B should be loaded to `Marine` by the moment the loading of module A starts. Module A cannot be loaded if at least one imported function is absent in `Marine`.
|
* Module B should be loaded to `Marine` by the moment the loading of module A starts. Module A cannot be loaded if at least one imported function is absent in `Marine`.
|
||||||
|
|
||||||
|
See the examples below for wrapped `extern` block usage:
|
||||||
|
|
||||||
|
{% tabs %}
|
||||||
See the example below of a wrapped `extern` block:
|
{% tab title="Example 1" %}
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#[marine]
|
#[marine]
|
||||||
pub struct TestRecord {
|
pub struct TestRecord {
|
||||||
@ -79,6 +79,18 @@ extern "C" {
|
|||||||
pub fn foo(arg: Vec<Vec<Vec<Vec<TestRecord>>>>, arg_2: String) -> Vec<Vec<Vec<Vec<TestRecord>>>>;
|
pub fn foo(arg: Vec<Vec<Vec<Vec<TestRecord>>>>, arg_2: String) -> Vec<Vec<Vec<Vec<TestRecord>>>>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
{% endtab %}
|
||||||
|
|
||||||
|
{% tab title="Example 2" %}
|
||||||
|
```rust
|
||||||
|
[marine]
|
||||||
|
#[link(wasm_import_module = "some_module")]
|
||||||
|
extern "C" {
|
||||||
|
pub fn foo(arg: Vec<Vec<Vec<Vec<u8>>>>) -> Vec<Vec<Vec<Vec<u8>>>>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
{% endtab %}
|
||||||
|
{% endtabs %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user