summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarphaman <arphaman@gmail.com>2013-08-31 18:06:48 +0100
committerarphaman <arphaman@gmail.com>2013-08-31 18:06:48 +0100
commitb01eea1baac4a840bbcbfa2339b4adc4f89650fb (patch)
tree77d61c996703eaa3466a8ccaec776b788c94cca1
parentc3f0235696b59d22cf4c90ed18406d7b636af2f0 (diff)
downloadlibflangrt-b01eea1baac4a840bbcbfa2339b4adc4f89650fb.tar.gz
added system malloc and free functions
-rw-r--r--include/System/System.h2
-rw-r--r--lib/System/System.cpp9
2 files changed, 11 insertions, 0 deletions
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 <sys/time.h>
#include <stdint.h>
+#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);