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

Add initial documentation for C tooling #66

Merged
merged 6 commits into from
Aug 27, 2024

Conversation

seanisom
Copy link
Contributor

@seanisom seanisom commented Sep 10, 2023

Fixes #38

Creating as a draft for now as I would like to see #44 merged first as that will change the structure of /language-support - I will update the table of contents to match that once I can rebase from that.

Copy link
Collaborator

@kate-goldenring kate-goldenring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @seanisom! I was able to get this all working and running on the example host! There were a few parts where i deviated from the flow and a little bit more information we can add

wasm-tools component new ./add-core.wasm -o add-component.wasm
```

Do note this will fail if your code references any WASI APIs that must be imported. This requires an additional step as the WASI SDK still references `wasi_snapshot_preview1` APIs that are not compatible directly with components.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The adapter may have evolved in Wasmtime 13 as I am able to successfully create a component when adding print and the adapter automatically imports the wasi worlds

>wasm-tools component wit ./component.wasm
package root:component

world root {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My output does not have any of the WASI imports:

package root:component

world root {
  export add: func(x: s32, y: s32) -> s32
}

however, if i add print (necessitating the wasi cli imports) then my output matches

@sunfishcode
Copy link
Member

@seanisom It looks like #44 is merged now; are you able to continue working on this? In any case, would you like help finishing finishing this PR? There's good content here that would be great to have published; let me know if there's anything I can do to help!

@seanisom
Copy link
Contributor Author

Hey @sunfishcode @kate-goldenring , sorry for letting this go stale! Will rebase on top of the latest post #44 and incorporate the feedback.

Regarding host component support for C in wasmtime, I need to follow up on bytecodealliance/wasmtime#6987 - Bailey mentioned Alex may have already started this work. If that is complete or a significant uplift I can address that in a follow-up PR.

@rylev
Copy link
Collaborator

rylev commented Mar 21, 2024

@seanisom @kate-goldenring what's the state of this PR - is this blocked on anything in particular?

@breckcs
Copy link
Contributor

breckcs commented Apr 11, 2024

If this PR is going to be merged, don't forget to update the links on the landing page in introduction.md.

Go wasn't included there and at first I thought support for Go didn't exist. See: #128.

@rajsite
Copy link
Contributor

rajsite commented Aug 17, 2024

I think it would be great to start getting some docs in for C development that can grow over time. There really doesn't seem to be a good source generally (compared to other languages which have detailed docs elsewhere) and in the time this has been in review it's gotten outdated:

  • target names have changed in wasi-sdk
  • wasi-sdk has a dedicated p2 target
  • changes have been made to the wasi targets such that folks have expected workflows that don't seem well documented (it's expected users know to strip debug symbols that are always included now).

Those kind of updates would be easier to make in small PRs if the C docs became available.

@kate-goldenring
Copy link
Collaborator

@rajsite would you be willing to take on updating the docs? You could also open a new PR with the content and @seanisom could potentially jump in to review it

@rajsite
Copy link
Contributor

rajsite commented Aug 25, 2024

@rajsite would you be willing to take on updating the docs? You could also open a new PR with the content and @seanisom could potentially jump in to review it

Created a PR that I believe should resolve the remaining discussion from this thread and merges from main: #147

@kate-goldenring kate-goldenring merged commit 74d898e into bytecodealliance:main Aug 27, 2024
@seanisom seanisom deleted the feature-c-tooling branch August 27, 2024 18:30
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.

Language Guide: Add C
6 participants