Skip to content

Commit cafa004

Browse files
committed
fix(examples): import proxy_add_header_map_value from the env module
The transform example declares the Proxy-Wasm host function with a bare extern block. Under `lto = true`, rust-lld leaves it as an unresolved symbol and the wasm32 build fails to link. Annotate the block with `#[link(wasm_import_module = "env")]` so the symbol is emitted as a Wasm import, matching how the proxy-wasm SDK declares its host calls. Signed-off-by: Ramazan Kara <github@r-kara.de>
1 parent 208fad8 commit cafa004

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

examples/transform/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
88
// Import the host function for setting header map values.
99
// map_type 2 = HTTP_RESPONSE_HEADERS in the Proxy-Wasm ABI.
10+
// `wasm_import_module = "env"` makes rust-lld emit this as a Wasm import from
11+
// the host's "env" module (as the proxy-wasm SDK does) rather than leaving it
12+
// as an unresolved symbol, which fails linking under `lto = true`.
13+
#[link(wasm_import_module = "env")]
1014
extern "C" {
1115
fn proxy_add_header_map_value(
1216
map_type: i32,

0 commit comments

Comments
 (0)