atexit does not work

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

atexit does not work

Post by coolkehon »

I tried to use the stdlib function at exit so that it would save settings when yes on the homescreen is pressed and i couldnt get it to work i even added exit(EXIT_SUCCESS) in to the exit callback then it just crashes how can i get this to work so far my program calls osl_quit = 1; and sceKernelExitGame() in the exit_callback but if i try to call the function directly the psp crashes if i call exit() it crashes so what am i to do and if i have it save in the main after osl_quit = 1 then it doesnt even get called cause it doesnt reach it
Badboy_
Posts: 4
Joined: Sat Aug 09, 2008 2:39 am

Post by Badboy_ »

put your save_settings call in the exit callback...
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

tried that it crashes the psp when i do so
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Sounds more like one of the exit functions is crashing. You might try putting debug prints in them and see how far it gets.
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

i got it to work my main has to return 0 for it to work
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

coolkehon wrote:i got it to work my main has to return 0 for it to work
Ah... a lot of people think that because the PSP has its own exit function, they don't need to return something from main()... I do it anyway to suppress the warning, but I guess it really is needed. :)
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

no i had it return one before but it was never reached because sceKernelExitGame was called before return 0;

Code: Select all

int main(whatever)
{
sceKernelExitGame();
return 0;
}
Post Reply