summaryrefslogtreecommitdiffstats
path: root/examples/example-winmain/main.cpp
blob: a64328105b7396ee3b8bff4ec33eff07220571d1 (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
28
29
#define _CRT_SECURE_NO_WARNINGS
#include "../stacktrace-windows/common.h"

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

extern int exampleMain(int argc, char** argv);
extern const char* const g_logFileName;

int WinMain(
    HINSTANCE /* instance */,
    HINSTANCE /* prevInstance */,
    LPSTR /* commandLine */,
    int /*showCommand*/)

{
    FILE* logFile = fopen(g_logFileName, "w");
    __try
    {
        int argc = 0;
        char** argv = nullptr;
        return exampleMain(argc, argv);
    }
    __except (exceptionFilter(logFile, GetExceptionInformation()))
    {
        ::exit(1);
    }
}