mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
use dynamic rather than static initialization of globals for scripts compiled to C++
This commit is contained in:
parent
6ad28b37e6
commit
0687959f1c
5 changed files with 59 additions and 14 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <cerrno>
|
||||
|
||||
#include "zeek/script_opt/CPP/Compile.h"
|
||||
#include "zeek/script_opt/IDOptInfo.h"
|
||||
|
||||
extern std::unordered_set<std::string> files_with_conditionals;
|
||||
|
||||
|
@ -310,6 +311,9 @@ void CPPCompile::RegisterCompiledBody(const string& f)
|
|||
|
||||
void CPPCompile::GenEpilog()
|
||||
{
|
||||
NL();
|
||||
InitializeGlobals();
|
||||
|
||||
NL();
|
||||
for ( const auto& ii : init_infos )
|
||||
GenInitExpr(ii.second);
|
||||
|
@ -468,6 +472,9 @@ void CPPCompile::GenFinishInit()
|
|||
NL();
|
||||
Emit("load_BiFs__CPP();");
|
||||
|
||||
NL();
|
||||
Emit("init_globals__CPP();");
|
||||
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue