mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-06-27 05:21:38 +00:00
working import transform
This commit is contained in:
2
gas/Cargo.lock
generated
2
gas/Cargo.lock
generated
@ -13,7 +13,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-wasm"
|
name = "parity-wasm"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/nikvolf/parity-wasm#cafc5058357f6ea84daaec870057da8455bf74e8"
|
source = "git+https://github.com/nikvolf/parity-wasm#4011af4f75e9334a2a018fdb2f464d9c7eb21617"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -48,6 +48,8 @@ fn main() {
|
|||||||
// back to plain module
|
// back to plain module
|
||||||
let mut module = mbuilder.build();
|
let mut module = mbuilder.build();
|
||||||
|
|
||||||
|
assert!(module.global_section().is_some());
|
||||||
|
|
||||||
// calculate actual function index of the imported definition
|
// calculate actual function index of the imported definition
|
||||||
// (substract all imports that are NOT functions)
|
// (substract all imports that are NOT functions)
|
||||||
|
|
||||||
|
10
samples/contract1.c
Normal file
10
samples/contract1.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
int ops = 0;
|
||||||
|
|
||||||
|
void log(int block_ops) {
|
||||||
|
ops += block_ops;
|
||||||
|
}
|
||||||
|
|
||||||
|
int call(int x) {
|
||||||
|
log(5);
|
||||||
|
return 2 * x;
|
||||||
|
}
|
Reference in New Issue
Block a user