-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Labels
Milestone
Description
When building a Win32 GUI app (CMake add_executable(... WIN32 ...), standard output isn't printed to the IDE output view, and one has to use OutputDebugString() because ... Windows is special! So we need to comply with that. Fortunately people learned to use Debug etc. quite extensively, Debug can have scoped output redirection, and there's now Corrade::Main that could do this automagically in the background.
Things to do:
- Rework Debug to be able to output to a callback, not just ostreams
- Or temporarily implement an UGLY
std::basic_stringbufas seen on https://stackoverflow.com/questions/5248704/how-to-redirect-standard-output-to-output-window-from-visual-studio (but there it seems to be called char-by-char, isn't that slow?!) - This also needs the same fix as Android logcat redirection, to make asserts still print to it and not the default
std::cerr
- Or temporarily implement an UGLY
- https://docs.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-outputdebugstringw seems to be saying something about
WaitForDebugEventEx, the heck is that?! - Can I use
IsDebuggerPresent()to enable this conditionally only when running from an IDE? Does that function returntruealso when running a Release build / a build without debugger? Ugh. - Add an ability to open a console for a WIN32 app https://justcheckingonall.wordpress.com/2008/08/29/console-window-win32-app/
- There's also https://github.com/MicrosoftDocs/Console-Docs/blob/dev/lhecker/24h2/docs/console-allocation-policy.md , document that it's possible to make this automatic
- Would there be a way to make the console allocation automatic straight from code, w/o this manifest file entry?
- Also expose
_CrtSetReportMode(),_CrtSetReportFile()or_CrtSetReportHook()which control whether the assertion dialog box gets open or if the message gets printed to stdout etc
Cc: @hsdk123
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Projects
Status
TODO