tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

wasm: implement the //go:wasmimport directive

Open aykevl opened this issue 1 year ago • 2 comments

It is ~implemented upstream~ almost implemented upstream and looks pretty stable.

@neelance I'd like to get your opinion on this. This would mean that TinyGo implements the //go:wasmimport directive for all packages (not just runtime and syscall/js). This seems mostly safe to me, and certainly better than the current //go:wasm-module directive that we're using. What do you think, am I missing something? The ABI will be mostly the same as the one used in the Go toolchain, with minor differences here and there. It roughly matches the C ABI.

aykevl avatar Sep 15 '22 14:09 aykevl

fyi, this isn't quite in upstream, yet, though I personally support using this anyway https://go-review.googlesource.com/c/go/+/350737

codefromthecrypt avatar Sep 15 '22 23:09 codefromthecrypt

fyi, this isn't quite in upstream, yet

My bad, thanks for correcting.

aykevl avatar Sep 15 '22 23:09 aykevl

basic question...

//go:wasmimport directive is for Browser side or server side ? Or both ?

I wonder if this will also need to catchup ? chrome://extensions/?id=pdcpmagijalfljmkmjngeonclgbbannb It is the chrome dwarf debugger extension used to debug tinygo in the Chrome Browser.

gedw99 avatar Oct 06 '22 15:10 gedw99

https://github.com/golang/go/commit/02411bcd7c8eda9c694a5755aff0a516d4983952 has landed so hopefully this can move forward :)

anuraaga avatar Mar 02 '23 06:03 anuraaga

Reminder to @aykevl about this one :small_airplane:

deadprogram avatar Mar 21 '23 23:03 deadprogram

Updated and removed the commits from #3142 from this PR.

aykevl avatar Mar 21 '23 23:03 aykevl

We also need to update examples/wasm/export and the associated README with this change. I can submit a separate PR.

Thanks everyone for working on this, exciting to see this moving forward! Now merging.

deadprogram avatar Mar 22 '23 10:03 deadprogram