summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/wavm/Include/WAVM/Emscripten/Emscripten.h
blob: 66d09f9a0f527388b3bfdcc75650a8eb155aba2a (plain) (blame)
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
39
40
41
42
43
#pragma once

#include <functional>
#include <memory>
#include <vector>
#include "WAVM/IR/Value.h"

namespace WAVM { namespace IR {
	struct Module;
}}

namespace WAVM { namespace VFS {
	struct VFD;
}}

namespace WAVM { namespace Runtime {
	struct Compartment;
	struct Context;
	struct Instance;
	struct Resolver;
}}

namespace WAVM { namespace Emscripten {

	struct Process;

	WAVM_API std::shared_ptr<Process> createProcess(Runtime::Compartment* compartment,
													std::vector<std::string>&& inArgs,
													std::vector<std::string>&& inEnvs,
													VFS::VFD* stdIn = nullptr,
													VFS::VFD* stdOut = nullptr,
													VFS::VFD* stdErr = nullptr);
	WAVM_API bool initializeProcess(Process& process,
									Runtime::Context* context,
									const IR::Module& module,
									Runtime::Instance* instance);

	WAVM_API Runtime::Resolver& getInstanceResolver(Process& process);

	WAVM_API void joinAllThreads(Process& process);

	WAVM_API I32 catchExit(std::function<I32()>&& thunk);
}}