aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-02-15 11:31:51 +0000
committergingerBill <bill@gingerbill.org>2023-02-15 11:31:51 +0000
commit94c1331c071d4816bec44345393dfd07f75c97dc (patch)
treefa049dc71063ad5d743a766a8108d0daf2a28fb1 /core/runtime
parent48685e8bf15dada1734ad6463fafb7d00c86b2b0 (diff)
Implement `@(fini)` (opposite of `@(init)`)
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/core.odin7
-rw-r--r--core/runtime/default_temporary_allocator.odin6
2 files changed, 8 insertions, 5 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index c64ab7d3b..2d20310ae 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -507,11 +507,8 @@ Odin_Endian_Type :: type_of(ODIN_ENDIAN)
foreign {
@(link_name="__$startup_runtime")
_startup_runtime :: proc "odin" () ---
-}
-
-@(link_name="__$cleanup_runtime")
-_cleanup_runtime :: proc() {
- default_temp_allocator_destroy(&global_default_temp_allocator_data)
+ @(link_name="__$cleanup_runtime")
+ _cleanup_runtime :: proc "odin" () ---
}
_cleanup_runtime_contextless :: proc "contextless" () {
diff --git a/core/runtime/default_temporary_allocator.odin b/core/runtime/default_temporary_allocator.odin
index b71cd103a..85e76df6c 100644
--- a/core/runtime/default_temporary_allocator.odin
+++ b/core/runtime/default_temporary_allocator.odin
@@ -198,3 +198,9 @@ default_temp_allocator :: proc(allocator: ^Default_Temp_Allocator) -> Allocator
data = allocator,
}
}
+
+@(fini, private)
+_destroy_temp_allocator_fini :: proc() {
+ default_temp_allocator_destroy(&global_default_temp_allocator_data)
+ print_string("fini")
+}