fixes for standalone C++ scripts making types & variables/functions available

This commit is contained in:
Vern Paxson 2021-06-04 17:14:46 -07:00
parent fb9c73fa86
commit 725aa558a7
13 changed files with 125 additions and 19 deletions

View file

@ -22,7 +22,8 @@ function load_CPP%(h: count%): bool
%{
auto cb = detail::standalone_callbacks.find(h);
if ( cb == detail::standalone_callbacks.end() )
if ( cb == detail::standalone_callbacks.end() ||
! detail::CPP_init_hook )
{
reporter->Error("load of non-existing C++ code (%" PRIu64 ")", h);
return zeek::val_mgr->False();
@ -38,5 +39,8 @@ 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();
%}