was interested to see if i could commit an anchor entry in the init hook of the zome… lib.rs … i got a panic message after hc package:
thread 'main' panicked at 'Failed to instantiate module: Function("host module doesn\'t export function with name _ZN3hdk10global_fns10write_json17h75a7ef5ec08f4291E")', src/libcore/result.rs:1051:5
it could be that my rust is wrong…
any help appreciated
Hmm, judging by the phrase “host module” I’d say that this is a problem in the WASM compilation step. It’s looking for a piece of the HDK that’s missing. Can I ask you how you installed your dev environment, and what you see when you type in
hey @pauldaoust, thanks for reply… my environment is pretty standard setup. I am able to hc package fine etc…
using holochain 0.0.34-alpha1 + holonix 0.0.39
i will try to repeat the code in a later version and see if it works
best of luck; let me know how it goes. The last few holonix releases pushed to holochain.love had have some package-related issues.
There’s a new release on holonix that might be worth a try.
This means that your WASM module defines an import
_ZN3hdk10global_fns10write_json17h75a7ef5ec08f4291E - i.e. it expects to be linked with something that provides an according export of that same name. Since Holochain runs the DNA WASM modules alone, without any other module, it could only be provided by the runtime, i.e. the host module.
The Holochain host module only provides implementations of the HDK API functions, which should be the only imports defined by a proper DNA WASM. The fact that your DNA WASM has this import is the problem. I can’t say much about the reason for this without seeing your
Cargo.toml. Also, the toolchain with which you’ve compiled the WASM might be causing this. Are you compiling from a Holonix nix-shell?
You can see those imports (and exports) of a WASM module with wasm-objdump, which is part of WABT.