-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This is a specification for a way to customize console allocations. The new manifest type `consoleAllocationPolicy` and the new `AllocConsoleWithOptions` API were already added to the console client library internally. Closes #7335
- Loading branch information
Showing
4 changed files
with
406 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
71c35cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DHowett , big fan of this change and there is external incentive as well as can be seen on this StackOverflow thread. How do I know, because I just worked through this myself. I'm working on a Direct3D project, which in debug mode it sends some logs to a console window. It first tries to find the parent console window and attach to that, or if it is missing it allocates a new one. I eventually have settled on using a cli wrapper which creates a process to load the gui, following the python/pythonw sort of method, rather than having otherwise identical builds with only the /SUBSYSTEM flag changing.
It works, but it is also fragile because there is a need to keep both of these files together on the file system.
There is a caveat in the spec which should be considered. In my example, I'm trying to change this behavior based on different build targets, whether or not I'm making a release or debug build. Being able to change the manifest per build target should not be ignored as a possibility. For the release build, I'd want the behavior to exist as it does today and it is only the debug builds where I'd want to attach to the console without starting detached and returning control to the shell.71c35cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But nothing prevents you from having 2 manifests in your source tree and picking one for debug and the other for release builds. Or did I misunderstand what you're trying to achieve?
71c35cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhecker, you might be right. I've not used the manifest before and made an assumption that this would be generated by VS. Even so, this is an implementation detail and not part of the spec, so this isn't really a concern and easily resolved. I'd prefer it if there was a simple way to apply this specific delta to the same manifest per build, but again that's an implementation detail and not part of this spec. Good call.
71c35cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS can indeed generate the manifest for you or change it according to your build settings, but it only includes some of the most basic ones (e.g. whether you want to launch as admin). I'm not sure if you're doing this already, but generally speaking, I can recommend writing your own manifest file. For instance, I recently wrote this one for one of my apps:
A
style APIs and those that are locale-awareTo build with that manifest, simply include it as a file in your solution explorer as if it was any other source file. The linker will take care of it. To change between Debug/Release, you can include 2 different manifest files, right-click on them, open the "Properties" dialog, and then change the "Excluded From Build" setting (= exclude one of them from all Debug configurations, and the other from all Release ones).