Hello everyone. I am trying to use SDL as wine backend and encountering
strange problem.
I made simple version of the problem. Can someone here tell me why it
segfaulting please? I am on RedHat 7.2 using SDL 1.2 on i386 platform.
I tried SDL IRC channel, and stepped through SDL code but I don’t see why…
P. S. Please include me in replies as I as not subscribed to list…
Thanks in advance.
#include “SDL/SDL.h” /* All SDL App’s need this */
#include <stdio.h>
int main() {
SDL_Surface *screen, *src, *dst;
SDL_Rect rsrc, rdst;
printf("Initializing SDL.\n");
/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO)==-1)) {
printf("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
}
printf("SDL initialized.\n");
if (!(screen = SDL_SetVideoMode(640, 480, 16, 0)))
printf("Setvideo failed...\n");
printf("Allocating src...\n");
if (!(src = SDL_CreateRGBSurface(0, 1024, 32, 1, 0,0,0,0)))
printf("Allocating src failed...\n");
printf("Allocating dst...\n");
if (!(dst = SDL_CreateRGBSurface(0, 2080, 32, 1, 0,0,0,0)))
printf("Allocating dst failed...\n");;
rsrc.x = 0;
rsrc.y = 0;
rsrc.w = 1023;
rsrc.h = 31;
rdst.x = 0;
rdst.y = 0;
rdst.w = 1023;
rdst.h = 31;
rdst.x = 0;
rdst.y = 0;
rdst.w = 1023;
rdst.h = 31;
SDL_BlitSurface(src, &rsrc, dst, &rdst);
SDL_FreeSurface(src);
SDL_FreeSurface(dst);
printf(“Quiting SDL.\n”);
/* Shutdown all subsystems */
SDL_Quit();
printf("Quiting....\n");
exit(0);
}