-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command prompt is shown when you launch <appName>.exe #576
Comments
Hmm, the product dependency is important (would you like to create a PR against the swift-win32-application template to fix the issue or should I just do it?) but separate.. The expectation is that there would be no console window. How were you launching the application? I think I may have just not realized that a console window is created because I always launched the application from the console. |
|
Okay, I've definitely not been exercising the launch from explorer, which explains how this got through. Thinking more about it, it seems quite reasonable. A quick validation on this project shows that this is in fact, behaving "as expected" (as per the definition of Microsoft rather than as per my intention). The problem here is that the entry point is being used for identifying the subsystem, and mis-categorizing the application as being a Windows CUI application rather than a Windows GUI application. Unfortunately, the entry point for the application is not entirely under the control of this framework (ignoring For the case that the user uses the |
@h4cky would you mind testing with compnerd/swift-win32-application@ac42bea ? I think that should avoid the console window. It is not exactly ideal, and it seems like this is a good item to bring up on the forums as a generalization that should be made available through the driver (and SPM). It is likely to require some sort of evolution proposal, but now that we know what features Swift needs to provide, taking a request for changes to Swift seems reasonable to discuss on the forums. Thanks for reporting this issue! |
CC: @yostane - this might be a good thing to document, if you feel up to it :) |
|
Oh, bleh, that seems like it might be a 5.5+ thing. That is really rather unfortunate. For pre-5.5, I think that there is very little choice other than: @_silgen_name("wWinMain")
func wWinMain(_ hInstance: HINSTANCE, _ hPrevInstance: HINSTANCE, _ pCmdLine: PWSTR, _ nCmdShow: CInt) -> CInt {
return ApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, nil)
} You would also need to add: linkerSettings: [
.unsafeFlags(["-Xlinker", "/SUBSYSTEM:WINDOWS"]),
] to the targets in |
where do I place this? |
That should be possible to add to the same file as the application delegate. |
@h4cky compnerd/swift-win32-application@d3e5306 should give you a more instructive example of what I was trying to explain. |
That's the desired effect. Thanks!!! I suspected that I am missing some import ;) |
Hi, thanks for the suggestion, I'll try to take a look :) |
I was keeping this open for the fact that the demo applications (Calculator and UICatalog) needed the changes applied to them, but I've created new tasks to track them. I'll cover the documentation via the project board. I'm going to close off this issue. Thanks for reporting this @h4cky! |
Hi,
As per request from @compnerd I'am moving the discussion about the issue described here, original link: How can I get rid of the command promt window presented with my SwiftWin32 app? to here.
Summary (for those don't wanting to visit Swift Forums): Every time when i manually launch .exe it is presented above Command Prompt window - which i don't whant there :)
Versions of installed software:
If you think any other information will help, ask away
Regards,
h4cky
P.S: Interesting thing which I just saw and remembered.
after checking out swift-win32-application as my template on first
swift build
it shows the following error:'Application' D:\Developer\sw32a\swift-win32-application: error: product dependency 'SwiftWin32' in package 'swift-win32' not found
which i solve in the following way in Package.swift:
name: "SwiftWin32"
on .package in root dependencies arraycurrent swift build output:
build.log
The text was updated successfully, but these errors were encountered: