aboutsummaryrefslogtreecommitdiff
path: root/base/runtime/entry_wasm.odin
blob: 52bb0e07219f741212f2cc7a65875b009ea2272e (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
39
#+private
#+build wasm32, wasm64p32
#+no-instrumentation
package runtime

import "base:intrinsics"

when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
	when ODIN_OS == .Orca {
		@(linkage="strong", require, export)
		oc_on_init :: proc "c" () {
			context = default_context()
			#force_no_inline _startup_runtime()
			intrinsics.__entry_point()
		}
		@(linkage="strong", require, export)
		oc_on_terminate :: proc "c" () {
			context = default_context()
			#force_no_inline _cleanup_runtime()
		}
	} else {
		@(link_name="_start", linkage="strong", require, export)
		_start :: proc "c" () {
			context = default_context()

			when ODIN_OS == .WASI {
				_wasi_setup_args()
			}

			#force_no_inline _startup_runtime()
			intrinsics.__entry_point()
		}
		@(link_name="_end", linkage="strong", require, export)
		_end :: proc "c" () {
			context = default_context()
			#force_no_inline _cleanup_runtime()
		}
	}
}