memory/macro.rs
1/// Macro to instantiate a global allocator using a Xila memory allocator.
2///
3/// This macro creates a static global allocator using the provided expression and
4/// applies the `#[global_allocator]` attribute to it. This is the recommended way
5/// to set up the global allocator in applications using Xila memory management.
6#[macro_export]
7macro_rules! instantiate_global_allocator {
8 ($allocator:expr) => {
9 #[global_allocator]
10 #[unsafe(no_mangle)]
11 pub static __XILA_MEMORY_MANAGER: $crate::Manager = $crate::Manager::new($allocator);
12 };
13}