MeshLib Documentation
Loading...
Searching...
No Matches
MRStacktrace.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4
5#ifndef __EMSCRIPTEN__
6
7#include <string>
8
9#ifdef _WIN32
10// it is tricky to use std::stacktrace on other systems: https://stackoverflow.com/q/78395268/7325599
11#include <version>
12#if __cpp_lib_stacktrace >= 202011
13#pragma message("std::stacktrace is available")
14#include <stacktrace>
15#else
16#pragma message("std::stacktrace is NOT available, using boost::stacktrace instead")
17#include <boost/stacktrace.hpp>
18#endif
19#else //not _WIN32
20#include <boost/stacktrace.hpp>
21#endif //_WIN32
22
23namespace MR
24{
25
29[[nodiscard]] inline std::string getCurrentStacktraceInline()
30{
31#if defined _WIN32 && __cpp_lib_stacktrace >= 202011
32 return to_string( std::stacktrace::current() );
33#else
34 return to_string( boost::stacktrace::stacktrace() );
35#endif
36}
37
40
41} //namespace MR
42
43#endif
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRCameraOrientationPlugin.h:8
MRMESH_API void printStacktraceOnCrash()
Print stacktrace on application crash.
std::string getCurrentStacktraceInline()
Definition MRStacktrace.h:29