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  const char* id = nullptr;
31  void (*init_module)() = nullptr;
34  nullptr;
35  unsigned int* globals_idx =
36  nullptr;
37 };
38 
40 extern void registerModule(HiltiModule module);
41 
43 #define HILTI_PRE_INIT(func) static ::hilti::rt::detail::ExecutePreInit __pre_init_##__COUNTER__(func);
44 
47 public:
48  ExecutePreInit(void (*f)()) { (*f)(); }
49 };
50 
51 } // namespace detail
52 
53 } // namespace hilti::rt
void init()
Definition: init.cc:19
void(* init_module)()
Definition: init.h:31
Definition: init.h:28
unsigned int * globals_idx
Definition: init.h:35
Definition: any.h:7
void(* init_globals)(hilti::rt::Context *ctx)
Definition: init.h:33
void done()
Definition: init.cc:58
bool isInitialized()
Definition: init.cc:75
const char * name
Definition: init.h:29
Definition: context.h:24