aboutsummaryrefslogtreecommitdiffstats
path: root/__cpp.h
diff options
context:
space:
mode:
authorZoRo <dos21h@gmail.com>2018-07-31 21:02:55 +0100
committerZoRo <dos21h@gmail.com>2018-07-31 21:02:55 +0100
commit7649df10ac7d1503fde181faa5d356177b40c2df (patch)
tree28681731095cebe9cdac73d37ad9c1af1d7c7bcc /__cpp.h
downloadnotifylist-7649df10ac7d1503fde181faa5d356177b40c2df.tar.gz
notifylist-7649df10ac7d1503fde181faa5d356177b40c2df.zip
Initial commit
Diffstat (limited to '__cpp.h')
-rw-r--r--__cpp.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/__cpp.h b/__cpp.h
new file mode 100644
index 0000000..ee23b68
--- /dev/null
+++ b/__cpp.h
@@ -0,0 +1,20 @@
+extern "C" void* emulate_cc_new(unsigned long len) { \
+ void *p = malloc(len);
+ if (p == 0) {
+ /* Don't use stdio (e.g. fputs), because that may want to allocate more
+ * memory.
+ */
+ (void)!write(2, "out of memory\n", 14);
+ abort();
+ }
+ return p;
+}
+extern "C" void emulate_cc_delete(void* p) {
+ if (p != 0)
+ free(p);
+}
+void* operator new (unsigned long) __attribute__((alias("emulate_cc_new")));
+void* operator new[](unsigned long) __attribute__((alias("emulate_cc_new")));
+void operator delete (void* p) __attribute__((alias("emulate_cc_delete")));
+void operator delete[](void* p) __attribute__((alias("emulate_cc_delete")));
+void* __cxa_pure_virtual = 0; \ No newline at end of file