Issue #2 resolved

Only check for errors on error return value

Christoph Reiter
created an issue

It seems like SDL_CreateRenderer() for example sets an error while still returning a valid pointer, so the approach to just check the error after a function call doesn't work.

        mainwindow = SDL_CreateWindow("SDL Test Window", SDL_WINDOWPOS_CENTERED,
            SDL_WINDOWPOS_CENTERED, 512, 512, SDL_WINDOW_SHOWN)

        ren = SDL_CreateRenderer(mainwindow, -1, SDL_RENDERER_PRESENTVSYNC)

Comments (3)

  1. Daniel Holth repo owner

    I'm going to be regenerating all of the wrappers using the cffi parsed declarations, I will probably be replacing almost everything but the sdl apipkg and the C header file.

    SDL_CreateWindow is checking the address of a char in its shared library, maybe to make sure the parent library is in the same address space as the function implementing the renderer, but I don't really know why it does it. This fails and it sets an error. The solution is to just ignore errors on that one fn.

  2. Log in to comment