summaryrefslogtreecommitdiffstats
path: root/third_party/rlbox_wasm2c_sandbox/include/wasm2c_rt_minwasi.h
blob: 51542b5d1e2893453d3e24cb23d8c4afb7c83e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef WASM_RT_MINWASI_H_
#define WASM_RT_MINWASI_H_

/* A minimum wasi implementation supporting only stdin, stdout, stderr, argv
 * (upto 100 args) and clock functions. */

#include <stdbool.h>
#include <stdint.h>

#include "wasm-rt.h"

#ifdef __cplusplus
extern "C"
{
#endif

  typedef struct w2c_wasi__snapshot__preview1
  {
    wasm_rt_memory_t* instance_memory;

    uint32_t main_argc;
    const char** main_argv;

    uint32_t env_count;
    const char** env;

    void* clock_data;
  } w2c_wasi__snapshot__preview1;

  bool minwasi_init();
  bool minwasi_init_instance(w2c_wasi__snapshot__preview1* wasi_data);
  void minwasi_cleanup_instance(w2c_wasi__snapshot__preview1* wasi_data);

#ifdef __cplusplus
}
#endif

#endif