EOSERV Forum > Programming > Exiting a program outside main function
Topic is locked.
Page: << 1 >>
Exiting a program outside main function
Author Message
Post #195736 Exiting a program outside main function


I m making a project with the allegro game library ,i could use int set_close_button_callback(void (*proc)(void)); which controls which function will be executed after clicking the x button then i do "allegro_exit()"  or std::exit(0) in the exit function, but my program won't exit well and it will be still open but not responding because i didn't return from the main function.


the only chance if i have is to do a while loop in the main function that performs stuff when the x button isn't clicked ,after the loop is done i could normally return from the main function,


however i don't think the while loop is good idea and it won't fit my program.


any chance of doing this in another way?

edit:problem solved using winapi,could have used winapi to kill the process but i had declaration conflicts when including windows.h, now i found that allegro has winalleg.h which is compatible. 

---
Remember when is not an organization nor a fucking group , it's simply an idea that we believe in
and live for.
The priority of Remember when should come before oxygen , as oxygen is cosmetic even life itself is
cosmetic,that's why offer our worthless lives to The "Remember when"
10 years, 24 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > Programming > Exiting a program outside main function