Skip to content
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

[Bug] wxCatapult: when built on mingw or msvc win32, "catapult.exe --version" emits nothing. [sf#485] #18

Open
openMSX-import opened this issue Jun 24, 2015 · 14 comments

Comments

@openMSX-import
Copy link

Reported by joxy on 2013-07-30 05:54 UTC
Must emit a textual version info.

@openMSX-import
Copy link
Author

Updated by joxy on 2013-08-01 05:10 UTC

  • summary: wxCatapult: when built on mingw, "catapult.exe --version" emits nothing. --> wxCatapult: when built on mingw or msvc win32, "catapult.exe --version" emits nothing.

@openMSX-import
Copy link
Author

Commented by joxy on 2013-08-04 09:24 UTC
(18:20:46) egp_: f*ck
(18:20:59) egp_: I call HANDLE hStdOut = ::GetStdHandle(STD_OUTPUT_HANDLE); in mingw
(18:21:04) egp_: it returns OK
(18:21:32) egp_: and returns an OK handle
(18:21:33) egp_: but ::WriteFile gives "Bad descriptor" for the above handle
(18:21:47) egp_: that's why --version doesn't work in Windows
(18:22:08) egp_: Any thoughts on this "Bad descriptor"?

Any Windows gurus here?

I don't kinda want to invest too much time in Windows internals, so I give up on this bug

@openMSX-import
Copy link
Author

Updated by joxy on 2013-08-04 09:28 UTC

  • assigned_to: joxy --> nobody
  • Group: Next_release --> Postpone_until_after_next_release

@openMSX-import
Copy link
Author

Commented by manuelbi on 2013-08-04 16:36 UTC
Why do you need all that HANDLE stuff?? Isn't it a matter to simply print a string?

I made some version stuff a bit simpler today, maybe it helps, let me know.

@openMSX-import
Copy link
Author

Commented by joxy on 2013-08-04 19:38 UTC
Manuel, I tried std::wcout — this doesn't help. I didn't try std::cout.

@openMSX-import
Copy link
Author

Commented by manuelbi on 2013-08-04 20:00 UTC
Does it work with the current code?

If not, did you try to find out where it is going wrong? E.g., perhaps the VERSION info is simply not generated correctly. Did you look at the generated Version.ii? Is the version in the About box correct with MinGW?

@openMSX-import
Copy link
Author

Commented by joxy on 2013-08-04 20:23 UTC
Wrong place is where something like ::WriteFile gets called and reports "Bad descriptor" for STD_OUT.

@openMSX-import
Copy link
Author

Commented by manuelbi on 2013-08-04 20:29 UTC
I found that line: line 1182 in openMSXController.cpp.

But that code is writing the XML to openMSX. It has nothing to do with printing the version of wxCatapult...

Is that part of the code also giving problems?

@openMSX-import
Copy link
Author

Updated by joxy on 2013-08-05 08:37 UTC

  • assigned_to: joxy

@openMSX-import
Copy link
Author

Commented by joxy on 2013-08-05 08:59 UTC
Manuel:

  • "I made some version stuff a bit simpler today, maybe it helps, let me know."

std:cout doesn not fix this bug. I just tested --version.

  • "Did you look at the generated Version.ii?"

Yes. Version.ii is fine.

  • "Is the version in the About box correct with MinGW?"

With mingw32, the About box and its versions labels are fine.

  • Something like WINAPI ::WriteFile gets called from within std::cout << . I didn't debug this deep, but it's for sure. And it seems to fail with "Bad desciptor" (GetLastError() returns error code 6). I will now test.
  • openMSXController::WriteMessage(xmlChar* msg, size_t length) has nothing to do with --version. WriteMessage seems to work OK. Though the code is bad: returned values must be checked, I file a separate bug report for this.
  • A bottomline: I will add GetLastError handling to std::cout<<, maybe this could help.

@openMSX-import
Copy link
Author

Commented by joxy on 2013-08-05 09:18 UTC
GetLastError returns 0 (success)...

@openMSX-import
Copy link
Author

Commented by m9710797 on 2013-08-05 10:11 UTC
Printing something on stdout in c++ should be as simple as:

#include
...
std::cout << "Hello, world!" << std::endl;

Unfortunately unicode stuff complicates things a bit. I won't go into all
the details. But the short story is that to be portable you can only
(easily) print ascii text. but for our --version stuff that's all we need.

To print utf-8 strings (that only contains ascii chars) you don't need to
do any conversion. To print wxStrings (that only contains ascii chars)
you first have to convert them via the ToAscii() method. So:

std::string myUTF8String = ...;
wxString myWxString = ...;

std::cout << "This is a std::string " << myUTF8String << std::endl;
std::cout << "This is a wxString " << myWxString.ToAscii() << std::endl;

Wouter

On Sun, Aug 4, 2013 at 10:23 PM, joxy [email protected] wrote:

Wrong place is where something like ::WriteFile gets called and reports "Bad
descriptor" for STD_OUT.


[bugs:#485] wxCatapult: when built on mingw or msvc win32, "catapult.exe
--version" emits nothing.

Status: open
Labels: wxCatapult
Created: Tue Jul 30, 2013 05:54 AM UTC by joxy
Last Updated: Sun Aug 04, 2013 08:00 PM UTC
Owner: nobody

Must emit a textual version info.


Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/openmsx/bugs/485/

To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/

@openMSX-import
Copy link
Author

Commented by manuelbi on 2013-08-05 21:06 UTC
You can really assume that std::cout works on Windows, There's no need to dive into the platform specific code that lies under that. There must be some other thing going on.

@openMSX-import
Copy link
Author

Commented by joxy on 2013-08-11 20:55 UTC
Tested. GetLastError / FormatMessage return smth like "No error" after std::cout << call. Though this call emits nothing to the stdout.

I guess maybe wxWidgets initialize the CRT strangely...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant