aboutsummaryrefslogtreecommitdiff
path: root/WinRpMalloc/src/dllmain.c
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-08 14:44:01 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-08 14:44:01 -0500
commitbe6dc557a3b819248b014992eb96c1cb21f8112b (patch)
tree5361530552856ba8154bfcfbfac8377549117c9e /WinRpMalloc/src/dllmain.c
parent072a1294646542a73007784d08a35ffcad557b1b (diff)
Initial commit
Diffstat (limited to 'WinRpMalloc/src/dllmain.c')
-rw-r--r--WinRpMalloc/src/dllmain.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/WinRpMalloc/src/dllmain.c b/WinRpMalloc/src/dllmain.c
new file mode 100644
index 0000000..10ea3f5
--- /dev/null
+++ b/WinRpMalloc/src/dllmain.c
@@ -0,0 +1,27 @@
+// dllmain.cpp : Defines the entry point for the DLL application.
+
+#include "pch.h"
+
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ /*
+ * Taken from the malloc.c file for initializing the library.
+ * and thread events
+ */
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ rpmalloc_initialize();
+ break;
+ case DLL_THREAD_ATTACH:
+ rpmalloc_thread_initialize();
+ break;
+ case DLL_THREAD_DETACH:
+ rpmalloc_thread_finalize(1);
+ break;
+ case DLL_PROCESS_DETACH:
+ rpmalloc_finalize();
+ break;
+ }
+ return TRUE;
+} \ No newline at end of file