October 25, 2024
Chicago 12, Melborne City, USA
C#

SDL_Init() segfaults after somehow calling my close() function?


Why does this code:

/* gcc test.c -o test -lSDL2 -Wall -Wextra */
#include <SDL2/SDL.h>

void close() {
    printf("HERE\n");
    SDL_Quit();
}

int main() {
    SDL_Init(SDL_INIT_VIDEO);
    return 0;
}

…cause a segfault after printing multiple times "HERE"? Is the close function defined in sdl and called during the init?

I compiled it on archlinux, if i remove the close function or rename it works fine.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video