diff --git a/src/script_opt/CPP/CPP-load.bif b/src/script_opt/CPP/CPP-load.bif index 4e6105b0bb..87528ce658 100644 --- a/src/script_opt/CPP/CPP-load.bif +++ b/src/script_opt/CPP/CPP-load.bif @@ -39,8 +39,5 @@ function load_CPP%(h: count%): bool // compiled scripts. detail::standalone_activations.push_back(cb->second); - // Proceed with activation. - (*detail::CPP_init_hook)(); - return zeek::val_mgr->True(); %} diff --git a/src/script_opt/CPP/Inits.cc b/src/script_opt/CPP/Inits.cc index f1d7a52338..376fc93ea3 100644 --- a/src/script_opt/CPP/Inits.cc +++ b/src/script_opt/CPP/Inits.cc @@ -213,17 +213,11 @@ void CPPCompile::GenStandaloneActivation() { NL(); -#if 0 Emit("void standalone_activation__CPP()"); StartBlock(); - for ( auto& a : activations ) - Emit(a); - EndBlock(); -#endif + Emit("finish_init__CPP();"); NL(); - Emit("void standalone_init__CPP()"); - StartBlock(); // For events and hooks, we need to add each compiled body *unless* // it's already there (which could be the case if the standalone @@ -283,10 +277,14 @@ void CPPCompile::GenStandaloneActivation() GenTypeName(ft), hashes); } + EndBlock(); + NL(); + Emit("void standalone_init__CPP()"); + StartBlock(); + Emit("init__CPP();"); Emit("CPP_activation_funcs.push_back(standalone_activation__CPP);"); Emit("CPP_activation_hook = activate__CPPs;"); - EndBlock(); } @@ -300,15 +298,6 @@ void CPPCompile::GenLoad() Emit("register_scripts__CPP(%s, standalone_init__CPP);", Fmt(total_hash)); - // Spit out the placeholder script, and any associated module - // definitions. - for ( const auto& m : module_names ) - if ( m != "GLOBAL" ) - printf("module %s;\n", m.c_str()); - - if ( module_names.size() > 0 ) - printf("module GLOBAL;\n\n"); - printf("global init_CPP_%llu = load_CPP(%llu);\n", total_hash, total_hash); }