Last active
March 20, 2024 08:19
-
-
Save ArnCarveris/535cf7c25007271bfa75d6396853a4a3 to your computer and use it in GitHub Desktop.
flecs for godbolt.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <stdio.h> | |
static void flecs_safe_sigsegv(int sig, siginfo_t *info, void *uc_void) | |
{ | |
fflush(stdout); | |
fflush(stderr); | |
} | |
static void flecs_safe_sethandler(int sig, void (*handler)(int, siginfo_t *, void *), | |
int flags) | |
{ | |
struct sigaction sa; | |
memset(&sa, 0, sizeof(sa)); | |
sa.sa_sigaction = handler; | |
sa.sa_flags = SA_SIGINFO | flags; | |
sigemptyset(&sa.sa_mask); | |
if (sigaction(sig, &sa, 0)) | |
printf("sigaction"); | |
} | |
static ecs_world_t *ecs_init_for_godbolt(int argc, char *argv[]) | |
{ | |
flecs_safe_sethandler(SIGSEGV, flecs_safe_sigsegv, 0); | |
return ecs_init_w_args(argc, argv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment