Return value from juce apps

Sorry if this is covered elsewhere but I couldn’t find it. Is there a way to specify the return value of a juce app? It seems like the JUCEApplication::quit() method would be the place but it doesn’t take the app’s return value as an argument.

Thanks for the help.


It just returns 0 at the moment, because I’d have thought that in a GUI app the return code would never be used (at least, I can’t think when I’d ever need a return value??)… And in a command line app you’d return the value in your own code.

But it’s easy enough to set a return value - give me a good reason, and I’ll add it!

The first reason I wanted it is to indicate failures in initialise but if there’s some uncaught exception or other failure farther along, it would be nice to indicate that as well.


you can use exit(n) call if you just need to return something… plain c calls are working (obviously!) well…

I guess, but then the app doesn’t cleanly shutdown. In the case of an unhandled exception that’s not so bad, and probably not either in the case where initialise fails. I’m sure there are other places where specifying a return value is useful and clean shutdown is more important that I haven’t thought of though.

sure, go blame jules for not having thought about this !

I’ve added a method to do this now, in the JUCEApplication class…