Stream: wamr

Topic: wamrc static intializer


view this post on Zulip Binh Phan (Jul 09 2024 at 21:44):

Hi guys, i'm new at this, but why is it when compile and run this as AOT. I get a Sig 7 erorr

#include <vector>
struct  T {
        std::vector<int> updates;
};
T t;
__attribute__((export_name("Init"))) int Init() {
    int size = t.updates.size();
    t.updates.push_back(1);
    size = t.updates.size();
    return 0;
}

This works fine

#include <vector>
struct  T {
        std::vector<int> updates;
};
__attribute__((export_name("Init"))) int Init() {
   T t;
    int size = t.updates.size();
    t.updates.push_back(1);
    size = t.updates.size();
    return 0;
}

view this post on Zulip Binh Phan (Jul 09 2024 at 21:45):

i ran into a similar issue in .wasm where all I had to do was add -mexec-model=reactor wondering if there is a similar
configuration i can do for AOT?

view this post on Zulip Notification Bot (Jul 10 2024 at 17:01):

This topic was moved here from #general > wamrc static intializer by fitzgen (he/him).


Last updated: Nov 22 2024 at 16:03 UTC