🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3118

Indy 9: winsock2.h and winsock.h conflict resolution

#3118
From: Daniel Stevenson
Date: Mon, 21 Nov 2005 22:34
25 lines
2053 bytes
after successfully installing Indy9.0.17, I had to add a conditional
_WINSOCKAPI_ which stopped my initial "multiple definitions of ..."
conflicts between winsock.h and winsock2.h

This then created a lot of other errors "[C++ error] Winsock.hpp(21), E2257
' expected" on MOST of my existing forms.

I therefore had to include "#include <winsock2.h>" before my "#include
<vcl.h>" which now leaves me with quite a number of warnings about "[C++
warning] _prolog.h(41): W8059 Structure packaging size has changed size"

What has confused me the most is that not all my forms require the "#include
<winsock2.h>" before the "#include <vcl.h>" line and still compiled without
any errors.

According to my research, the windows.h calls upon windows.h which in turn
calls upon winsock.h and therefore the only way to stop the errors that are
generated is by including winsock2.h prior to vcl.h.  But if I can compile a
form that is directly using the indy components without first including
winsock2.h, how does this not cause a problem with winsock.h?

Can someone explain why the include winsock2.h is required in some
situations and not in others?

Thanks
Technical Details
Message-ID: <43824b20$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed.cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,6c4df013894db185,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Daniel Stevenson" <daniel@ocreage.com.au>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Indy 9: winsock2.h and winsock.h conflict resolution
Date: Tue, 22 Nov 2005 09:34:06 +1100
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 150.101.156.50
Message-ID: <43824b20$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1132612384 150.101.156.50 (21 Nov 2005 14:33:04 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed.cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail