| 18 | using namespace wasmtime; |
| 19 | |
| 20 | static std::vector<uint8_t> read_binary_file(const char *path) { |
| 21 | std::ifstream file(path, std::ios::in | std::ios::binary); |
| 22 | if (!file.is_open()) { |
| 23 | throw std::runtime_error(std::string("failed to open wasm file: ") + path); |
| 24 | } |
| 25 | std::vector<uint8_t> data((std::istreambuf_iterator<char>(file)), |
| 26 | std::istreambuf_iterator<char>()); |
| 27 | return data; |
| 28 | } |
| 29 | |
| 30 | int main() { |
| 31 | // Define the WASI functions globally on the `Config`. |