Spicy
init.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 namespace hilti::rt {
6 
7 struct Context;
8 
13 extern void init();
14 
19 extern void done();
20 
22 extern bool isInitialized();
23 
24 namespace detail {
25 
28 struct HiltiModule {
29  const char* name{};
30  void (*init_module)() = nullptr;
33  nullptr;
34  unsigned int* globals_idx =
35  nullptr;
36 };
37 
39 extern void registerModule(HiltiModule module);
40 
42 #define HILTI_PRE_INIT(func) static ::hilti::rt::detail::ExecutePreInit __pre_init_##__COUNTER__(func);
43 
46 public:
47  ExecutePreInit(void (*f)()) { (*f)(); }
48 };
49 
50 } // namespace detail
51 
52 } // namespace hilti::rt
void init()
Definition: init.cc:18
void(* init_module)()
Definition: init.h:30
Definition: init.h:28
unsigned int * globals_idx
Definition: init.h:34
Definition: any.h:7
void(* init_globals)(hilti::rt::Context *ctx)
Definition: init.h:32
void done()
Definition: init.cc:58
bool isInitialized()
Definition: init.cc:75
const char * name
Definition: init.h:29
Definition: context.h:23