-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement without C dependency #15
Conversation
@@ -281,18 +270,18 @@ func (m *Memory) Store(data []byte) { | |||
} | |||
|
|||
func (m *Memory) Free() { | |||
C.extism_free(m.offset) | |||
extism_free(m.offset) | |||
} | |||
|
|||
func (m *Memory) Length() uint64 { | |||
return m.length | |||
} | |||
|
|||
func (m *Memory) Offset() uint64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wondered whether this should return ExtismPointer
and then FindMemory
also use it... to avoid some potential errors. However, that would be a backwards incompatible change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're nearing a 1.0 release, so let's break things if needed in order to improve the code & APIs!
For reference if interested:
extism/extism#420
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, also -- is it even necessary to expose Offset
and FindMemory
? If it's not necessary, then the decision can be pushed further down the line until it's necessary.
@egonelbre this is a great change, thank you! will give it a more thorough pass tomorrow but so far looks good |
Perhaps a naive question, I'm less familiar with this repo than @nilslice and @zshipko . Does this work in both Go and tinygo? Also, do we support host functions yet in this repo? Not seeing anything in the docs about it. |
Overall though, yes I endorse this. Love seeing the advancements in Wasm support in the Go ecosystem and not relying on C stuff. I'm also okay with any breaking changes. We can bump this to a 1.0 pre-release version if we want to break the API |
@bhelx yes, both tinygo and regular go should work. It probably would make sense to add tests for both compilers, currently it seems only tinygo is tested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Merging.
Go 1.21 introduced
go:wasmimport
, which means there's no need for usingC
for imports.