Skip to content
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(go): added the missing [resource-drop] imports for resources #797

Merged
merged 3 commits into from
Jan 2, 2024

Conversation

Mossaka
Copy link
Member

@Mossaka Mossaka commented Dec 23, 2023

This commit adds the missing [resource-drop] imports for both imported and exported resources in wit-bindgen-go.

For import, it implements a wasmimport directory that declares a drop function as an import.

//go:wasmimport {import_module} [resource-drop]{name}
func _{type_name}_drop(self {type_name})

Then the resource can use Drop() function to drop their handle. See updated runtime tests for this new update.

For exports, the story is a big different. Although I have implemented Drop<Resourc Name>() function for each exported resource, I do not find a use case that could utilize this function. Perhaps I am missing something. Nevertheless, I added this function in the generated code which invokes C's drop function given the owning handler type.

@Mossaka Mossaka changed the title feat(go): added the missing [resource-drop] imports for resources feat(go): added the missing [resource-drop] imports for resources Dec 23, 2023
@alexcrichton alexcrichton merged commit 104a2c0 into bytecodealliance:main Jan 2, 2024
9 checks passed
@Mossaka Mossaka deleted the resource-drop branch January 2, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants