about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedtbbmalloc.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-12-17 11:19:56 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-12-17 11:19:56 +0100
commit2aa7c45ca298c6ed49f86a17f3f77959275147c0 (patch)
treeec03a54be8bf8eb99d82fcadf213db5dba0bb689 /src/wrapped/wrappedtbbmalloc.c
parent73467dc523081ecd0ffad503d6f46c2c58057f90 (diff)
downloadbox64-2aa7c45ca298c6ed49f86a17f3f77959275147c0.tar.gz
box64-2aa7c45ca298c6ed49f86a17f3f77959275147c0.zip
More work on malloc override and tbbmalloc wrapping
Diffstat (limited to 'src/wrapped/wrappedtbbmalloc.c')
-rw-r--r--src/wrapped/wrappedtbbmalloc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wrapped/wrappedtbbmalloc.c b/src/wrapped/wrappedtbbmalloc.c
new file mode 100644
index 00000000..f2618999
--- /dev/null
+++ b/src/wrapped/wrappedtbbmalloc.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define _GNU_SOURCE         /* See feature_test_macros(7) */
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "wrapper.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+
+// Fake the lib for now, don't load it
+const char* tbbmallocName = "libtbbmalloc.so.2";
+#define LIBNAME tbbmalloc
+
+// this preinit basically open "box64" as dlopen
+#define PRE_INIT\
+    lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);    \
+    if(0)
+
+#include "wrappedlib_init.h"