#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "dlltest.h"

/*
    LibMain is called if Windows (un)load the DLL or threads are created

    The function LibMain is also defined in the library
*/

int APIENTRY LibMain(HANDLE hInst, DWORD fdwReason, LPVOID lpReserved)
{
    if (fdwReason == DLL_PROCESS_ATTACH)
        MessageBox(NULL, "LibMain(): DLL loaded", "Attach", MB_OK);
    else if (fdwReason == DLL_PROCESS_DETACH)
        MessageBox(NULL, "LibMain(): DLL unloaded", "Detach", MB_OK);

    return TRUE;
}

int CALLBACK Maximum(int x1, int x2)
{
    return (x1 > x2) ? x1 : x2;
}

int CALLBACK Minimum(int x1, int x2)
{
    return (x1 < x2) ? x1 : x2;
}

int CALLBACK _add(int x1, int x2)
{
    return x1 + x2;
}

int CALLBACK _sub(int x1, int x2)
{
    return x1 - x2;
}
