aboutsummaryrefslogtreecommitdiff
path: root/WinRpMalloc/src/dllmain.c
blob: 10ea3f5c877c46778100806f24e42d617f507bfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}