mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-15 17:26:58 +00:00
Hot-Reloading Refactor
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
ae1a4fd283
commit
6c1434c165
212 changed files with 5679 additions and 4206 deletions
44
src/core/mods/macros.rs
Normal file
44
src/core/mods/macros.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
#[macro_export]
|
||||
macro_rules! mod_ctor {
|
||||
( $($body:block)? ) => {
|
||||
$crate::mod_init! {{
|
||||
$crate::debug_info!("Module loaded");
|
||||
$($body)?
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! mod_dtor {
|
||||
( $($body:block)? ) => {
|
||||
$crate::mod_fini! {{
|
||||
$crate::debug_info!("Module unloading");
|
||||
$($body)?
|
||||
$crate::mods::canary::report();
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! mod_init {
|
||||
($body:block) => {
|
||||
#[used]
|
||||
#[cfg_attr(target_family = "unix", link_section = ".init_array")]
|
||||
static MOD_INIT: extern "C" fn() = { _mod_init };
|
||||
|
||||
#[cfg_attr(target_family = "unix", link_section = ".text.startup")]
|
||||
extern "C" fn _mod_init() -> () $body
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! mod_fini {
|
||||
($body:block) => {
|
||||
#[used]
|
||||
#[cfg_attr(target_family = "unix", link_section = ".fini_array")]
|
||||
static MOD_FINI: extern "C" fn() = { _mod_fini };
|
||||
|
||||
#[cfg_attr(target_family = "unix", link_section = ".text.startup")]
|
||||
extern "C" fn _mod_fini() -> () $body
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue