-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[wasm][wasi] No main function should be required when building a library #96869
Comments
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsDescriptionCurrently mono requires a main function when building for wasi. This shouldn't be required. Related: #96419 @AaronRobinsonMSFT @lewing @yowl @jsturtevant Reproduction StepsTry to build example with Expected behaviorNo main function should be required for a library. Actual behaviorMain function is required. Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Similar requirement tracked for browser in #77191 |
This should be triggered by |
One problem I encountered last year was IL trimmer complaining about missing root Implementation has two parts
|
We probably might need a different mechanism to compile library as wasm library. Currently we need
In typicaly solution user would have several library projects and (one or some) exe projects that are applications. Those library projects might have RID set to *-wasm to enable wasm API. Currenly only the application projects would do the wasm build. Which is correct IMO. If we support wasm build on OutputType=library, it would a lot of additional steps in such solution. Other parts of .NETE SDK include special steps in build by including a special SDKs in project definition (like The Currently Wasm SDK always imports web related SDKs https://github.com/dotnet/sdk/blob/main/src/WasmSdk/Sdk/Sdk.props#L32. We need to add a guard to do it only for browser-wasm. In the meantime we can workaround it by explicitly setting |
Description
Currently mono requires a main function when building for wasi. This shouldn't be required.
Related: #96419
@AaronRobinsonMSFT @lewing @yowl @jsturtevant
Reproduction Steps
Try to build example with
main
removed.Example: https://github.com/silesmo/wasm-unmanaged-callers-bug/blob/main/mono-example/MonoEntrypoint.cs
Expected behavior
No main function should be required for a library.
Actual behavior
Main function is required.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: