-
Notifications
You must be signed in to change notification settings - Fork 51
Consider using a tool to generate c bindings over manual creation #329
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
Comments
I looked into using the generator. The generator takes the approach of doing low level bindings (dotnet/ClangSharp#509 (comment) and dotnet/ClangSharp#427 (comment)). This requires a slightly different approach and use of unsafe in a few places since it prefers to generate raw pointers over As an example, I converted one of the I still think there might be value in going this approach so it isn't manual to look up the c api's then map them back to this repo but as you can see with #328 some of the changes are not that difficult. Going to think on it a bit more and explore how many changes have happened since the last release here (case in point; finding the diffs is one of the harder aspects of the doing this manually). Would love to hear others thoughts as well. |
This would be great, exposing both unsafe low-level bindings and higher level semantic constructs would be a boon to making this more usable for my needs. |
Interesting, I wasn't thinking of this use case (although the binding generator calls this out as one reason for this approach). We don't currently expose those bindings in a public way so would need some changes. @Hypatech would you mind sharing some more details on your use case? |
Gladly! I really want to be able to use WASM in Unity as a scripting platform for game mods, by offering WIT files for modders to implement new functionality / content.
|
Right now the api is generated by hand by referencing the wasmtime c library headers. We could automate this process which would make it easier to catch issues and make updates.
See:
Doing a little more digging, and it seems we could use a tool like https://github.com/dotnet/clangsharp?tab=readme-ov-file#generating-bindings to point at header files and generate c#. This would require a bit of changes to the project but would help catch the changes to files.
Originally posted by @jsturtevant in #315 (comment)
The text was updated successfully, but these errors were encountered: