[ASR] Initalization is not run unless using WASI
apple1417 opened this issue · comments
The _initialize
function is only run if an autosplitter links against WASI, but it's possible to write one requiring it which does not. This means it doesn't get initialized properly.
Minimal expample (prints empty string):
#include <asr.h>
#include <stdbool.h>
#include <stdint.h>
#include <string>
static std::string test_str = "abcd";
__attribute__((export_name("update"))) void update(void) {
static bool first_run = true;
if (first_run) {
first_run = false;
runtime_print_message((const uint8_t*)test_str.data(), test_str.size());
}
}