diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-05-30 19:57:25 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-05-30 19:57:25 +0330 |
commit | bb3822cbb347c712925530ded451fc9027f3b26f (patch) | |
tree | 19e3d3fdb99aa61f331346eeb559e5a625e94b7a /code/lib | |
parent | 1f529259c67dad4828908d502f40cb71d0345c56 (diff) |
add more memory management stuff
Diffstat (limited to 'code/lib')
-rw-r--r-- | code/lib/memory.felan | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/code/lib/memory.felan b/code/lib/memory.felan new file mode 100644 index 0000000..adb9cf2 --- /dev/null +++ b/code/lib/memory.felan @@ -0,0 +1,7 @@ +libc :: @c_library("/usr/lib/libc.so.6"); +malloc :: @c_function(libc,"malloc",(i64)->(*void)); +free :: @c_function(libc,"free",(*void)->void); + +malloc :: (size:i64,comptime t:type) -> (*t) { + return @cast(malloc(size*@cast(@size_of(t),i64)),*t); +}; |