Skip to content

Try to enhance no std support #98

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Sieluna
Copy link
Contributor

@Sieluna Sieluna commented Jan 19, 2025

Currently, only loading module through file uses std. We can consider excluding this part to make lib support no-std.

}
}

impl RuntimeBuilder {
/// create a named module runtime builder
Copy link
Contributor Author

@Sieluna Sieluna Jan 19, 2025

Choose a reason for hiding this comment

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

A new entrance for builder, make import module with variant names easier.

@Sieluna
Copy link
Contributor Author

Sieluna commented Jan 22, 2025

@lum1n0us Can you give me some suggestions? I think this proposal would be helpful.

@lum1n0us
Copy link
Collaborator

Love it. We might rebase this after PR #102 has been merged.


I thought the idea was about creating the smallest possible program without using the standard library, but it appears to be going in a different direction. Am I wrong?

@Sieluna
Copy link
Contributor Author

Sieluna commented Jan 22, 2025

I thought the idea was about creating the smallest possible program without using the standard library, but it appears to be going in a different direction. Am I wrong?

I think what I've done aligns with the principles advocated by Rust. However, it was inspired by this discussion:
https://stackoverflow.com/questions/57611219/when-adding-no-std-to-a-library-are-there-any-disadvantages-or-complicati

@lum1n0us
Copy link
Collaborator

lum1n0us commented Feb 3, 2025

Library users certainly don't need to worry. If a library enables no_std, its users are not required to enable no_std as well. The compiler will manage it appropriately.

Using no_std is definitely a challenge for library developers, since core is a subset of the std crate. Without access to alloc and advanced features (like Vec and String), developers face many limitations in programming. However, libraries also gain strong compatibility and cross-platform capabilities by using no_std.

@AlixANNERAUD
Copy link
Contributor

Any updates ?

@Sieluna
Copy link
Contributor Author

Sieluna commented Jun 17, 2025

Any updates ?

Actually, I was thinking we could completely use something like embedded-io to handle file streams. But this involves considerable changes, and I’m not sure whether it’s necessary to proceed.

@AlixANNERAUD
Copy link
Contributor

AlixANNERAUD commented Jun 19, 2025

Why not disable such feature because WAMR can works without files when using your own abstraction layer (not the one included within WAMR) or disabling such features. Only create alloc is required in the end.

@Sieluna
Copy link
Contributor Author

Sieluna commented Jun 19, 2025

Why not disable such feature because WAMR can works without files when using your own abstraction layer (not the one included within WAMR) or disabling such features. Only create alloc is required in the end.

This is already the case, there is no file system related code when no default features.

My suggestion is to use io::read to read the stream data. If wasm is large.

@lum1n0us Could you review this PR?

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.

3 participants