From b01eea1baac4a840bbcbfa2339b4adc4f89650fb Mon Sep 17 00:00:00 2001 From: arphaman Date: Sat, 31 Aug 2013 18:06:48 +0100 Subject: added system malloc and free functions --- include/System/System.h | 2 ++ lib/System/System.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/System/System.h b/include/System/System.h index aa3da84..66394c8 100644 --- a/include/System/System.h +++ b/include/System/System.h @@ -13,6 +13,8 @@ #include "Libflang.h" LIBFLANG_ABI void libflang_sys_init(); +LIBFLANG_ABI void *libflang_malloc(size_t size); +LIBFLANG_ABI void libflang_free(void *ptr); LIBFLANG_ABI float libflang_etime(float *time0, float *time1); #endif diff --git a/lib/System/System.cpp b/lib/System/System.cpp index 4964921..1f6df53 100644 --- a/lib/System/System.cpp +++ b/lib/System/System.cpp @@ -1,5 +1,6 @@ #include #include +#include "stdlib.h" #include "System/System.h" // FIXME: windows support. @@ -10,6 +11,14 @@ LIBFLANG_ABI void libflang_sys_init() { gettimeofday(&programStart, nullptr); } +LIBFLANG_ABI void *libflang_malloc(size_t size) { + return malloc(size); +} + +LIBFLANG_ABI void libflang_free(void *ptr) { + free(ptr); +} + LIBFLANG_ABI float libflang_etime(float *time0, float *time1) { timeval stop; gettimeofday(&stop, nullptr); -- cgit v1.2.1