provide a stacktrace function callable directly from C (libpbd_c_stacktrace())

This commit is contained in:
Paul Davis 2025-02-11 10:22:45 -07:00
parent 809d605a4a
commit 71f93d3c12
2 changed files with 12 additions and 0 deletions

View file

@ -38,6 +38,8 @@
#include "pbd/libpbd_visibility.h"
extern "C" { void libpbd_c_stacktrace (int levels); }
namespace PBD {
LIBPBD_API void stacktrace (std::ostream& out, int levels = 0, size_t start_level = 0);

View file

@ -131,3 +131,13 @@ PBD::stacktrace (std::ostream& out, int, size_t)
}
#endif
extern "C" {
void
libpbd_c_stacktrace (int levels)
{
PBD::stacktrace (std::cerr, levels);
}
}