Ian Branch 128 Posted February 12, 2020 Hi Team, I have just done a full svn of Indy10 rev 3627. As there is no Indy260.groupproj I used the the Indy250.groupproj. IndySystem250.bpl build fails with the following messages... "Building IndySystem250.dproj (Debug, Win32) [dcc32 Warning] IdGlobal.pas(9537): W1002 Symbol 'RegisterExpectedMemoryLeak' is specific to a platform [dcc32 Error] IdStackWindows.pas(1455): E2003 Undeclared identifier: 'IfIndex' [dcc32 Error] IdStackWindows.pas(1601): E2003 Undeclared identifier: 'AdapterIndex' [dcc32 Fatal Error] IdStack.pas(2394): F2063 Could not compile used unit 'IdStackWindows.pas'" Is this an error/bug or have I missed something? The other 4 projects in the package build OK. Regards & TIA, Ian Share this post Link to post
Remy Lebeau 1436 Posted February 13, 2020 (edited) 41 minutes ago, Ian Branch said: I have just done a full svn of Indy10 rev 3627. Indy does not use SVN anymore. The latest code is now on GitHub. Quote As there is no Indy260.groupproj I used the the Indy250.groupproj. That should be fine, though the resulting BPLs won't be named consistently with other packages installed in 10.3. I just haven't gotten around to making and posting project files for 260 yet. In part because I don't have 10.3 installed! Quote [dcc32 Warning] IdGlobal.pas(9537): W1002 Symbol 'RegisterExpectedMemoryLeak' is specific to a platform Hmm, interesting. I was not aware of that. I'll have to consider disabling that warning. Quote [dcc32 Error] IdStackWindows.pas(1455): E2003 Undeclared identifier: 'IfIndex' IfIndex is used when Indy calls GetAdaptersAddresses(), and the IP_ADAPTER_ADDRESSES record has an IfIndex field defined, so not sure why that error would be happening. Quote [dcc32 Error] IdStackWindows.pas(1601): E2003 Undeclared identifier: 'AdapterIndex' AdapterIndex is used when Indy calls GetAdaptersInfo(), but the IP_ADAPTER_INFO record does not have an AdapterIndex field defined. Not sure where I got that idea from when I wrote that code. I have fixed that now. Edited February 13, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 13, 2020 24 minutes ago, Remy Lebeau said: Indy does not use SVN anymore. The latest code is now on GitHub. Terminology - svn co https://github.com/IndySockets/Indy/trunk Indy10 25 minutes ago, Remy Lebeau said: That should be fine, though the resulting BPLs won't be named consistently with other packages installed in 10.3. I just haven't gotten around to making and posting project files for 260 yet. In part because I don't have 10.3 installed! OK. 26 minutes ago, Remy Lebeau said: Hmm, interesting. I was not aware of that. I'll have to consider disabling that warning. OK. I will ignore it. 26 minutes ago, Remy Lebeau said: IfIndex is used when Indy calls GetAdaptersAddresses(), and the IP_ADAPTER_ADDRESSES record has an IfIndex field defined, so not sure why that error would be happening. Will leave that one with you. 27 minutes ago, Remy Lebeau said: AdapterIndex is used when Indy calls GetAdaptersInfo(), but the IP_ADAPTER_INFO record does not have an AdapterIndex field defined. Not sure where I got that idea from when I wrote that code. I have fixed that now. Tks. I will svn the code again. Tks Remy, Ian Share this post Link to post
Ian Branch 128 Posted February 13, 2020 I've gone back to a previous revision for now. Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) 23 hours ago, Ian Branch said: Terminology - svn co https://github.com/IndySockets/Indy/trunk Indy10 There is no /trunk folder in GitHub. Quote I've gone back to a previous revision for now. Did you even try the fix I posted last night for you? The AdapterIndex error should be fixed now. Regarding the IfIndex error, Indy manually defines the IP_ADAPTER_ADDRESSES record only when HAS_UNIT_IpTypes is not defined. HAS_UNIT_IpTypes is defined for XE2+, and 10.3 is later than XE2, which means Indy is going to use an external (hopefully Delphi's!) definition of IP_ADAPTER_ADDRESSES rather than Indy's definition. It would stand to reason that the external definition lacks the IfIndex field (why, I don't know), otherwise you wouldn't be getting an error on it. Double-check Delphi's definition in the RTL's Winapi.IpTypes.pas unit is accurate, and also make sure you are not falling into this trap. In the meantime, a simple workaround would be to just comment out the {$DEFINE HAS_UNIT_IpTypes} statement in IdStackWindows.pas for now. Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Hi Remy, 2 minutes ago, Remy Lebeau said: There is no /trunk folder in GitHub. What can I say? It works. I am open to an alternative download string to "svn co https://github.com/IndySockets/Indy/trunk Indy10". 2 minutes ago, Remy Lebeau said: Did you even try the fix I posted last night for you? The AdapterIndex error should be fixed now. Yes, per my earlier I svn downloaded rev 3628. Yes the AdapterIndex error is no more. 3 minutes ago, Remy Lebeau said: So, a simple workaround would be to just comment out the {$DEFINE HAS_UNIT_IpTypes} statement in IdStackWindows.pas for now. Tks. I will give it a try and advise. Regards, Ian Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) 14 minutes ago, Ian Branch said: What can I say? It works. I am open to an alternative download string to "svn co https://github.com/IndySockets/Indy/trunk Indy10". See Support for Subversion clients in GitHub's documentation. Quote Yes, per my earlier I svn downloaded rev 3628. Now that Indy is on GitHub, SVN revision numbers don't really have any meaning to Indy anymore. There is no readily available mapping of GitHub's SVN revision numbers to GIT commits within the GIT system, so when you say "svn rev XYZ", I don't know which GIT commit that actually refers to, unless I go access the system via SVN and look at the metadata. Just saying... Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Hi Remy, Tried your suggestion for the IfIndex error. Still get it. 😞 I even deleted the Define line, just to be sure. Is it possible that any other 3rd Party I have installed is causing the issue? Regards, Ian Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 15 minutes ago, Ian Branch said: Yes the AdapterIndex error is no more. OK Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) 9 minutes ago, Ian Branch said: Tried your suggestion for the IfIndex error. Still get it. 😞 But, did you validate whether Delphi's definition of IP_ADAPTER_ADDRESSES has IfIndex or not? I don't have access to the RTL's IpTypes.pas source file right now to look myself, I'll do that tomorrow. 9 minutes ago, Ian Branch said: Is it possible that any other 3rd Party I have installed is causing the issue? Indy should not be accessing any 3rd party IpTypes unit. But, that is why I did say to make sure that is not happening (did you read that link yet?): Quote Changing IPtypes to winapi.IPtypes fixed the problem If HAS_UNIT_IpTypes is defined, then try making that same change to IdStackWindows.pas. But, if HAS_UNIT_IpTypes is not defined, then that doesn't matter, and you should not be getting the error since Indy does define the IfIndex field in its own definition of the IP_ADAPTER_ADDRESSES record: IP_ADAPTER_ADDRESSES = record Union: record case Integer of 0: ( Alignment: ULONGLONG); 1: ( Length: ULONG; IfIndex: DWORD); // <-- HERE!!!!! end; Next: PIP_ADAPTER_ADDRESSES; AdapterName: PIdAnsiChar; FirstUnicastAddress: PIP_ADAPTER_UNICAST_ADDRESS; FirstAnycastAddress: PIP_ADAPTER_ANYCAST_ADDRESS; FirstMulticastAddress: PIP_ADAPTER_MULTICAST_ADDRESS; FirstDnsServerAddress: PIP_ADAPTER_DNS_SERVER_ADDRESS; DnsSuffix: PWCHAR; Description: PWCHAR; FriendlyName: PWCHAR; PhysicalAddress: array [0..MAX_ADAPTER_ADDRESS_LENGTH - 1] of BYTE; PhysicalAddressLength: DWORD; Flags: DWORD; Mtu: DWORD; IfType: IFTYPE; OperStatus: IF_OPER_STATUS; Ipv6IfIndex: IF_INDEX; ZoneIndices: array [0..15] of DWORD; FirstPrefix: PIP_ADAPTER_PREFIX; TransmitLinkSpeed: ULONG64; ReceiveLinkSpeed: ULONG64; FirstWinsServerAddress: PIP_ADAPTER_WINS_SERVER_ADDRESS_LH; FirstGatewayAddress: PIP_ADAPTER_GATEWAY_ADDRESS_LH; Ipv4Metric: ULONG; Ipv6Metric: ULONG; Luid: IF_LUID; Dhcpv4Server: SOCKET_ADDRESS; CompartmentId: NET_IF_COMPARTMENT_ID; NetworkGuid: NET_IF_NETWORK_GUID; ConnectionType: NET_IF_CONNECTION_TYPE; TunnelType: TUNNEL_TYPE; // // DHCP v6 Info. // Dhcpv6Server: SOCKET_ADDRESS; Dhcpv6ClientDuid: array [0..MAX_DHCPV6_DUID_LENGTH - 1] of Byte; Dhcpv6ClientDuidLength: ULONG; Dhcpv6Iaid: ULONG; FirstDnsSuffix: PIP_ADAPTER_DNS_SUFFIX; end; Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 2 minutes ago, Remy Lebeau said: But, did you validate whether Delphi's definition of IP_ADAPTER_ADDRESSES has IfIndex or not? I don't have access to IpTypes.pas right now to look myself. Pardon my ignorance but I am unsure how to do that. 3 minutes ago, Remy Lebeau said: Indy should not be accessing any 3rd party IpTypes unit. But, that is why I did say to make sure that is not happening (did you read that link yet?). I looked at it but didn't understand it. 😞 Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 1 minute ago, Ian Branch said: Pardon my ignorance but I am unsure how to do that. I looked at it but didn't understand it. 😞 Refresh and look at my updated previous reply Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Hi Remy, Apologies for being a PITA. My winapi.IPtypes has the following.. PIP_ADAPTER_ADDRESSES = ^_IP_ADAPTER_ADDRESSES; {$EXTERNALSYM PIP_ADAPTER_ADDRESSES} _IP_ADAPTER_ADDRESSES = record Union: record case Integer of 0: ( Alignment: ULONGLONG); 1: ( Length: ULONG; IfIndex: DWORD); end; Next: PIP_ADAPTER_ADDRESSES; Ian Share this post Link to post
Ian Branch 128 Posted February 14, 2020 P.S. I changed the uses ...., IpTypes to ...., WinApi.IpTypes, in IdStackWindows but no change. Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Hi Remy, To make 100% sure we are dealing with the same code base I just did per the GitHib instructions for svn you directed me to. "svn co https://github.com/IndySockets/Indy.git Indy10New" It gave me 'Branches' and 'Trunk' sub directories and within Trunk were all the usual folders/files. 🙂 Retried Indy250.groupproj. - Same result. 😞 Ian Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) 24 minutes ago, Ian Branch said: My winapi.IPtypes has the following.. That clearly shows that the IfIndex field is present in Delphi's definition of IP_ADAPTER_ADDRESSES, as it should be. 22 minutes ago, Ian Branch said: P.S. I changed the uses ...., IpTypes to ...., WinApi.IpTypes, in IdStackWindows but no change. I don't know what else to tell you then. If you load up Indy's IndySystem package in the IDE and Ctrl-Click on PIP_ADAPTER_ADDRESSES in the IdStackWindows.pas code, where does it take you? Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Hi Remy, I don't know if it has any bearing but I just noticed your.. IP_ADAPTER_ADDRESSES = record is different to mine.. _IP_ADAPTER_ADDRESSES = record Ian Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) 4 minutes ago, Ian Branch said: I don't know if it has any bearing but I just noticed your.. IP_ADAPTER_ADDRESSES = record is different to mine.. _IP_ADAPTER_ADDRESSES = record It shouldn't matter. Delphi defines it with a leading underscore, Indy does not. Delphi should have another statement that maps _IP_ADAPTER_ADDRESSES to IP_ADAPTER_ADDRESSES. Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 2 minutes ago, Remy Lebeau said: It shouldn't matter. Delphi defines it with a leading underscore, Indy does not. Delphi should have another statement that maps _IP_ADAPTER_ADDRESSES to IP_ADAPTER_ADDRESSES. Yes it does. Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) Let's do a quick test: create a new test app, and put something like this in it: program Test; {$APPTYPE CONSOLE} uses Winapi.IpTypes; var A: IP_ADAPTER_ADDRESSES; begin A.IfIndex := 0; end. If that compiles, then I'm out of ideas why Indy fails to compile when accessing IfIndex when using the definition of IP_ADAPTER_ADDRESSES from either Winapi.IpTypes or IdStackWindows. Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Hi Remy, Nope. Doesn't compile. Undeclared identifier for IfIndex. "[dcc32 Error] Project23.dpr(11): E2003 Undeclared identifier: 'IfIndex'" Ian Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 (edited) 42 minutes ago, Ian Branch said: Nope. Doesn't compile. Undeclared identifier for IfIndex. "[dcc32 Error] Project23.dpr(11): E2003 Undeclared identifier: 'IfIndex'" Nevermind, I'm blind. I see the issue now. It needs to be referred to as Union.IfIndex instead: A.Union.IfIndex := 0; Now I know what needs to be fixed in Indy, too. I'll do that tomorrow. Edited February 14, 2020 by Remy Lebeau Share this post Link to post
Ian Branch 128 Posted February 14, 2020 Yup. Well done. "TIdStackLocalAddressAccess(LAddress).FInterfaceIndex := Adapter^.Union.IfIndex;" Fixes it. Regards, Ian Share this post Link to post
Remy Lebeau 1436 Posted February 14, 2020 17 hours ago, Ian Branch said: Yup. Well done. "TIdStackLocalAddressAccess(LAddress).FInterfaceIndex := Adapter^.Union.IfIndex;" Fixes it. I just now checked in that fix. Share this post Link to post
Ian Branch 128 Posted February 14, 2020 (edited) Morning Remy, or Evening, as the case may be. I did a fresh pull. I noticed the Indy260.groupproj and tried it but not all of the libraries are there yet. I then tried Indy250.groupproj, all there, went to build and got the following messages. "Building IndySystem250.dproj (Debug, Win32) [dcc32 Warning] IdGlobal.pas(9537): W1002 Symbol 'RegisterExpectedMemoryLeak' is specific to a platform [dcc32 Error] IdCTypes.pas(191): E2003 Undeclared identifier: 'size_t' [dcc32 Fatal Error] IndySystem250.dpk(51): F2063 Could not compile used unit 'IdCTypes.pas' Failed" The other 4 libraries seem to build OK. Regards, Ian Edited February 14, 2020 by Ian Branch Update Share this post Link to post