blob: 0c778bcd7fe2f00e55419f419448178e5d42c9f8 [file]
/*
Copyright (c) 2018 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include "runtime/alloc.h"
#include "runtime/debug.h"
#include "runtime/thread.h"
#include "runtime/object.h"
#include "runtime/io.h"
#include "runtime/stack_overflow.h"
#include "runtime/process.h"
#include "runtime/mutex.h"
#include "runtime/init_module.h"
#include "runtime/libuv.h"
namespace lean {
// idempotent as it may be called both by the generated `main` and, via `lean_initialize`,
// by generated module initializers
static bool g_initialized = false;
extern "C" LEAN_EXPORT void lean_initialize_runtime_module() {
if (g_initialized)
return;
g_initialized = true;
initialize_alloc();
initialize_debug();
initialize_object();
initialize_io();
initialize_thread();
initialize_mutex();
initialize_process();
initialize_stack_overflow();
initialize_libuv();
}
void initialize_runtime_module() {
lean_initialize_runtime_module();
}
void finalize_runtime_module() {
finalize_stack_overflow();
finalize_process();
finalize_mutex();
finalize_thread();
finalize_io();
finalize_object();
finalize_debug();
finalize_alloc();
}
}