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

Late initialization of the host environments #2893

Closed
adrien-zinger opened this issue May 20, 2022 · 0 comments · Fixed by #2892
Closed

Late initialization of the host environments #2893

adrien-zinger opened this issue May 20, 2022 · 0 comments · Fixed by #2892
Assignees
Labels
bug Something isn't working priority-high High priority issue
Milestone

Comments

@adrien-zinger
Copy link

The problem occurs when the start function and call the ABI, it looks like the host environment isn't yet initialized and functions like
env.remaining_points.as_ref() return an error.

We can reproduce with that kind of code:

    let resolver: ImportObject = imports! {
        "my_api" => {
            // other stuff
            "foo" => Function::new_native_with_env(&store, env.clone(), foo),
        },
    };

    // [....]
    fn foo(env: &Env) {
        env.remaining_points.as_ref().unwrap() // <-- panic if foo is called in the start function
    }
@adrien-zinger adrien-zinger added the bug Something isn't working label May 20, 2022
@epilys epilys added the priority-high High priority issue label May 20, 2022
@epilys epilys self-assigned this May 20, 2022
@epilys epilys added this to the v3.0 milestone Jun 21, 2022
@bors bors bot closed this as completed in 06474c1 Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high High priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants