void (*initFunc)(void), when I build my test application the program crashes midway through the function. The first line is a debug saying "setInitFunc()", last line says "endInitFunc", the middle line just sets one of my global function pointers to what was passed in. (Relevant code below, if you need more just ask). This is being done in C using Codeblocks on Ubuntu 10.04.
Definition of setInitFunc (in FrozenCore.c)
Code: Select all
void setInitFunc( void (*initFunc)(void) ) {
printf("setInitFunc()\n");
init = initFunc;
printf("endInitFunc\n");
}
Code: Select all
#include "FrozenCore.h"
void init() {
}
void update() {
}
void render(SDL_Surface* screen) {
SDL_Rect rect = (SDL_Rect) {25, 25, 25, 25};
SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, 255, 255, 0));
}
int main(int argc, char* argv[]) {
setInitFunc(init);
setUpdateFunc(update);
setRenderFunc(render);
startGame(640, 480, 0);
return 0;
}