Skip to content

Commit

Permalink
Fixed winsock redefinition on QT
Browse files Browse the repository at this point in the history
  • Loading branch information
Jester565 committed Apr 13, 2017
1 parent 03e7523 commit d390f1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CommProto/include/CommProto/network/commsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
#define __COMMSOCKET_H

#include <CommProto/architecture/os/include_defines.h>
#include <CommProto/architecture/connection/socket-config.h>
#include <CommProto/architecture/api.h>

class sockaddr_in;

namespace comnet {
namespace network {

Expand Down
3 changes: 1 addition & 2 deletions CommProto/src/network/tcpsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <CommProto/network/commsocket.h>

#include <CommProto/architecture/connection/socket-config.h>
#include <CommProto/debug/comms_debug.h>

#include <CommProto/architecture/os/os_threads.h>

#include <cstdlib>
Expand Down
1 change: 1 addition & 0 deletions modules/csharp/network/TCPLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define __CSHARP_TCP_LINK_H
#include <network/CommsLink.h>
#include <CommProto/network/commsocket.h>
#include <CommProto/architecture/connection/socket-config.h>
#include <vcclr.h>
#using <mscorlib.dll>
#using <System.dll>
Expand Down

16 comments on commit d390f1b

@MichaelWallace30
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol the solution looks so simple

@Jester565
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real struggle was getting GCS installed. It only took me like an hour to figure it out after that.

@CheezBoiger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I want to know is how in the living dog sh*t is Qt getting to anything TCPLink, UDPLink, or XBeeLink related, when the only time it's being included is inside Comms.cc, after it's already been compiled into a library. There is virtually no other place it can get to commsocket or network related files...

@Jester565
Copy link
Collaborator Author

@Jester565 Jester565 commented on d390f1b Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connection state manager is in the header for Comms.

@CheezBoiger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connection state manager is not including socket-config though...

@MichaelWallace30
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt all connection types in comms.h

@Jester565
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. They are included in the source file.

@Jester565
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's just including windows.h?

@CheezBoiger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, if that was the case, we would be having a crap ton of issues lulz. Yes, as alex said, they are included in the source file.

@CheezBoiger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Qt were including windows.h globally, that is a seriously dim witted solution to simplifying programming gui applications.

@Jester565
Copy link
Collaborator Author

@Jester565 Jester565 commented on d390f1b Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They include windows.h in Joystick.h

@CheezBoiger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, you know what, then it was our issue, because console.h was including it when @Jester565 added in socket-config into commsocket. Adding it into GCS code, since I presume they included without using WIN32_LEAN_AND_MEAN, the issue was on the console file.

@Jester565
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was my bad but I wish the windows libraries would fix this somehow. I guess there's not much they can do if they are rewriting an entire socket library in the exact same namespace though.

@MichaelWallace30
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They arent using joystick i think i commented it out on my commits.

@Jester565
Copy link
Collaborator Author

@Jester565 Jester565 commented on d390f1b Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's one of their many dependencies? Cause I tried putting WINDOWS_LEAN_AND_MEAN in front of all our windows includes.

@CheezBoiger
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jester565 Yea unfortunately windows won't be fixing it, simply because their backwards compatibility oath. Winsock2 is just a replacement for winsock, it has all the same api calls, but with added protocols like bluetooth and wlan and stuffs, along with a better implementation with their tcp/ip network that winsock had trouble with. This is a result of poor design of their interface though, in my opinion. that is why we say we need to limit the amount of changes we do in header files. Otherwise you get problems like Angular.js and angular2.js. Not to mentio the Unity engine is known for this as well.

Please sign in to comment.