summaryrefslogtreecommitdiffstats
path: root/examples/example-main/main.cpp
blob: 46ffc7278df903d05a6ab3dbfec54a21456d54c5 (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
30
31
32
#include "../stacktrace-windows/common.h"

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

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

#if defined(_WIN32)

#include <windows.h>

int main(int argc, char** argv)
{
    __try
    {
        return exampleMain(argc, argv);
    }
    __except (exceptionFilter(stdout, GetExceptionInformation()))
    {
        ::exit(1);
    }
}

#else // defined(_WIN32)

int main(int argc, char** argv)
{
    // TODO: Catch exception and print stack trace also on non-Windows platforms.
    return exampleMain(argc, argv);
}

#endif