Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package?
Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package? [message #55627] Wed, 25 November 2020 12:29 Go to next message
mirek is currently offline  mirek
Messages: 13040
Registered: November 2005
Ultimate Member
Sometimes I am using main package as non-main (usually as temporary duck-tape solution, but still useful sometimes). In those situations, I usually add

#ifdef flagMAIN
GUI_APP_MAIN
{
	MyApp().Run();
}
#endif


around MAIN. Which now made me think: This could be done by the library too. Should I go there? I suspect that there might be some problems down the road...

Mirek

[Updated on: Wed, 25 November 2020 12:29]

Report message to a moderator

Re: Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package? [message #55643 is a reply to message #55627] Thu, 26 November 2020 19:13 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 815
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor

I'm doing that when using unit testing, which has its own main, running the test runner. (by #ifndef .. #endif preprocessor block, IIRC).
Re: Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package? [message #55647 is a reply to message #55643] Fri, 27 November 2020 08:45 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3248
Registered: August 2008
Senior Veteran
mr_ped wrote on Thu, 26 November 2020 19:13
I'm doing that when using unit testing, which has its own main, running the test runner. (by #ifndef .. #endif preprocessor block, IIRC).

I do just the same.


Best regards
IƱaki
Re: Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package? [message #55649 is a reply to message #55647] Fri, 27 November 2020 11:48 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13040
Registered: November 2005
Ultimate Member
Yeah, thanks that you have the same issue:)

Does not quite reply my question:

Should it be excluded by the U++, without the need for #ifdef? Do you see any catch?

Mirek
Re: Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package? [message #55659 is a reply to message #55627] Sat, 28 November 2020 18:02 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 815
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor

It sounds useful, but I'm not sure how to implement it (in most robust way to avoid any pitfalls in the future). (but also has to be reasonable simple to figure out, as most of the time I will probably forget about it, and do the #ifdef thing manually).

Does the build system has some unique flag for the top package?

Can you imagine project with top package not containing the main, but reusing one from the dependencies? Maybe something like project for plugin for particular app, having the full app as dependency? So in such case the main is needed.

I'm not sure, if this has simple-enough and obvious-enough solution to make it worth your time. Smile

If you have particular implementation on mind already...
Re: Should be GUI_APP_MAIN or CONSOLE_APP_MAIN ignored in non-main package? [message #55663 is a reply to message #55659] Sat, 28 November 2020 20:59 Go to previous message
mirek is currently offline  mirek
Messages: 13040
Registered: November 2005
Ultimate Member
[quote title=mr_ped wrote on Sat, 28 November 2020 18:02}
Can you imagine project with top package not containing the main, but reusing one from the dependencies? Maybe something like project for plugin for particular app, having the full app as dependency? So in such case the main is needed.
[/quote]

Thanks, that is exactly the kind of counter-argument I was looking for! Means NO, not a good idea... Smile

Mirek
Previous Topic: build_info.h
Next Topic: Cross Compilation: For Mac on Linux
Goto Forum:
  


Current Time: Tue Jan 19 19:04:46 CET 2021

Total time taken to generate the page: 0.02041 seconds