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

rename main -> start on wasm-bindgen(start) example #3648

Merged
merged 4 commits into from
Oct 11, 2023
Merged

rename main -> start on wasm-bindgen(start) example #3648

merged 4 commits into from
Oct 11, 2023

Conversation

kazuk
Copy link
Contributor

@kazuk kazuk commented Oct 9, 2023

I got error with this example.

error: entry symbol `main` declared multiple times
  |
  = help: did you use `#[no_mangle]` on `fn main`? Use `#[start]` instead

In this document, "main" is specified as the function name. However, compilation will fail due to the previously mentioned error if "main" is used. This is presumably because "main" is a function name reserved in Rust as the starting function for binaries.

rename to start then succeeded.

I got error with this example.

```
error: entry symbol `main` declared multiple times
  |
  = help: did you use `#[no_mangle]` on `fn main`? Use `#[start]` instead
```
Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

This is a bit surprising to me, but I believe it's better this way anyway to differentiate #[wasm_bindgen(start)] from #[wasm_bindgen(main)].

There are bunch of mentions to the main() functions in this file, those would need to be updated to start as well.

@daxpedda daxpedda added the waiting for author Waiting for author to respond label Oct 9, 2023
@kazuk
Copy link
Contributor Author

kazuk commented Oct 9, 2023

I re-test this. I got build error on wasm-pack test.

So main symbol conflicting with rust's cargo test generated main.

update description
works with non pub `fn start()`
@kazuk kazuk requested a review from daxpedda October 11, 2023 01:52
Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

Thank you!

@daxpedda daxpedda merged commit bfe644f into rustwasm:main Oct 11, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for author Waiting for author to respond
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants