MCPcopy Create free account
hub / github.com/acidicoala/SmokeAPI / init

Function init

src/main_linux.cpp:7–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "smoke_api/smoke_api.hpp"
6
7extern "C" void __attribute__((constructor)) init() {
8 // On linux we don't automatically get current module handle,
9 // hence we find it manually
10 Dl_info info;
11 if(dladdr(reinterpret_cast<void*>(&init), &info) && info.dli_fname) {
12 void* handle = dlopen(info.dli_fname, RTLD_NOW | RTLD_NOLOAD);
13 smoke_api::init(handle);
14 } else {
15 koalabox::util::panic("Initialization error: failed to get own module handle.");
16 }
17}
18
19extern "C" void __attribute__((destructor)) fini() {
20 smoke_api::shutdown();

Callers 1

DLL_MAINFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected