I'm trying to compile smart contracts written in Rust. So far so good, but when I tried to add memory management contract deployment choked.
(type (;0;) (func (param i32) (result i32)))
(import "env" "malloc" (func $malloc (type 0)))
This line in webassembly makes contract deployment fail with message
2663336ms thread-0 http_plugin.cpp:406 handle_exception] Exception Details: 10 assert_exception: Assert Exception
!"unresolvable": env.malloc
{"module":"env","export":"malloc"}
thread-0 wasm_interface.hpp:41 resolve
{"mod_name":"env","export_name":"malloc"}
thread-0 wasm_interface.hpp:43 resolve
{"_pending_console_output.str()":""}
thread-0 apply_context.cpp:62 exec_one
Although this method is listed in c function reference https://developers.eos.io/eosio-cpp/reference#memory
Other methods like printi and action_data_size works fine. So my question is how do I work with memory in smart contracts and how do I know which foreign functions are in "env" module and which are not?
#include <eosiolib/memory.hpp>