use dynamic rather than static initialization of globals for scripts compiled to C++

This commit is contained in:
Vern Paxson 2022-09-29 15:11:05 -07:00
parent 6ad28b37e6
commit 0687959f1c
5 changed files with 59 additions and 14 deletions

View file

@ -339,16 +339,7 @@ GlobalInitInfo::GlobalInitInfo(CPPCompile* c, const ID* g, string _CPP_name)
attrs = -1;
exported = g->IsExport();
auto v = g->GetVal();
if ( v && gt->Tag() == TYPE_OPAQUE )
{
reporter->Error("cannot compile to C++ global \"%s\" initialized to opaque value",
g->Name());
v = nullptr;
}
val = ValElem(c, v);
val = ValElem(c, nullptr); // empty because we initialize dynamically
}
void GlobalInitInfo::InitializerVals(std::vector<std::string>& ivs) const