Recent

Author Topic: WinInet compiling errors.  (Read 1358 times)

440bx

  • Hero Member
  • *****
  • Posts: 5593
WinInet compiling errors.
« on: June 20, 2025, 07:36:50 pm »
Hello,

I was looking into using WinInet and ran into unexpected problems when compiling.  The following trivial program refuses to compile:
Code: Pascal  [Select][+][-]
  1. {$APPTYPE CONSOLE}
  2.  
  3. program _TestWinInet;
  4.  
  5.  
  6. uses
  7.   WinInet;
  8.  
  9. begin
  10.  
  11.   readln;
  12. end.
  13.  
I get the following errors:
Quote
Hint: (11030) Start of reading config file D:\v4.0rc3\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Hint: (11031) End of reading config file D:\v4.0rc3\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 3.2.2 [2025/03/22] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
(1002) Target OS: Win64 for x64
(3104) Compiling TestWinInet.lpr
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(7,3) Hint: (5023) Unit "WinINet" not used in _TestWinInet
(9015) Linking H:\Dev\Tests\00_WinInet\TestWinInet.exe
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "PASCALMAIN"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "main"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "INITFINAL"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "FPC_THREADVARTABLES"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "FPC_RESOURCESTRINGTABLES"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "FPC_WIDEINITTABLES"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "FPC_RESSTRINITTABLES"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "__heapsize"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "__fpc_valgrind"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Error: (9209) Multiple defined symbol "$unwind$main"
H:\Dev\Tests\00_WinInet\TestWinInet.lpr(12,1) Fatal: (10026) There were 10 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: D:\v4.0rc3\fpc\3.2.2\bin\x86_64-win64\ppcx64.exe returned an error exitcode

Is the WinInet unit messed up or did I miss something ?

Thank you for your help.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 17451
  • Ceterum censeo Trumpum esse delendum (Tnx Charlie)
Re: WinInet compiling errors.
« Reply #1 on: June 20, 2025, 07:58:15 pm »
Here everything compiles OK, but you know I am using main.
The wininet unit has not been touched for ages. Nobody uses it, only for very old simple examples somebody found on the InterWeb.
You can try jwaWindows instead of Windows/Wininet, that will draw in a slightly different version.

If the version of Wininet.pas has been touched or modified in the past 10-15 years or so, Marcov would know.

It is probably way back beyond the svn/git transitions because I can't find it. ( I am not good with git)
« Last Edit: June 20, 2025, 08:09:53 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: WinInet compiling errors.
« Reply #2 on: June 20, 2025, 08:36:12 pm »
You can try jwaWindows instead of Windows/Wininet, that will draw in a slightly different version.
the jwa stuff does not include the WinInet functions.

If the version of Wininet.pas has been touched or modified in the past 10-15 years or so, Marcov would know.
It doesn't matter how long it has been since it has been modified.

The problem is determining why it does not compile with the current version of FPC.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 17451
  • Ceterum censeo Trumpum esse delendum (Tnx Charlie)
Re: WinInet compiling errors.
« Reply #3 on: June 20, 2025, 08:47:34 pm »
 Well it does in main and also in 3.2.0.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: WinInet compiling errors.
« Reply #4 on: June 20, 2025, 08:59:26 pm »
Well it does in main and also in 3.2.0.
Of course... everything but the current version.  You are so helpful.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12326
  • FPC developer.
Re: WinInet compiling errors.
« Reply #5 on: June 20, 2025, 11:26:33 pm »
Quote
c:\repo\fpc\packages\winunits-base\src>ppcrossx64 wininet.pp
Free Pascal Compiler version 3.2.2 [2021/05/15] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling wininet.pp
2793 lines compiled, 0.6 sec

and a program using it (name is wrong, typo, it is simply uses wininet; begin end. :

Free Pascal Compiler version 3.2.2 [2021/05/15] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling testwininit.pp
Linking testwininit.exe
3 lines compiled, 0.4 sec, 32384 bytes code, 1524 bytes data

No special parameters needed, compiled with the official i386+x86_64 combined FPC installer of 3.2.2, default fpc.cfg

From the errors is not really wininet, but something like including the/a main program twice. Note that the symbols are about the .lpr, not. Maybe something in your fpc.cfg, like a stale -Fl for mingw/msys use or so ?
« Last Edit: June 20, 2025, 11:34:40 pm by marcov »

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: WinInet compiling errors.
« Reply #6 on: June 20, 2025, 11:42:43 pm »
From the errors is not really wininet, but something like including the/a main program twice. Note that the symbols are about the .lpr, not. Maybe something in your fpc.cfg, like a stale -Fl for mingw/msys use or so ?
It's really strange.  I copied the entire wininet.pp into the test program and it compiled fine.

The moment there is "wininet" in the uses clause, I get all those errors.

As you said, there must be something, somewhere in my installation that collides with the "wininet" identifier.  I'll try to figure out what it is.

Marco, thank you for looking into it.  I appreciate it.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12326
  • FPC developer.
Re: WinInet compiling errors.
« Reply #7 on: June 20, 2025, 11:57:17 pm »
As you said, there must be something, somewhere in my installation that collides with the "wininet" identifier.  I'll try to figure out what it is.

-va in both cases, and play "spot the difference"?

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: WinInet compiling errors.
« Reply #8 on: June 21, 2025, 04:22:00 am »
I figured out what the problem was/is.

I had a small program called wininet.lpr (note the .lpr extension, not .pas), in the same directory as TestWininet.lpr, in spite of the extension being .lpr, the compiler apparently thought that it was the source for the wininet unit. 

I am a bit surprised that the compiler doesn't seem to take the extension into account.  I don't think a .lpr file is ever supposed to be a unit.  Am I mistaken about that ?
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

cdbc

  • Hero Member
  • *****
  • Posts: 2264
    • http://www.cdbc.dk
Re: WinInet compiling errors.
« Reply #9 on: June 21, 2025, 09:51:41 am »
Hi
The compiler doesn't care about extensions...
Code: Bash  [Select][+][-]
  1. bc@red test$ nano helloworld.txt
  2. bc@red test$ fpc helloworld.txt
  3. Free Pascal Compiler version 3.2.2 [2024/07/26] for x86_64
  4. Copyright (c) 1993-2021 by Florian Klaempfl and others
  5. Target OS: Linux for x86-64
  6. Compiling helloworld.txt
  7. Linking helloworld
  8. 5 lines compiled, 0.1 sec
  9. bc@red test$ ./helloworld
  10. Hello World 42
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: WinInet compiling errors.
« Reply #10 on: June 21, 2025, 10:58:42 am »
Hi
The compiler doesn't care about extensions...
Code: Bash  [Select][+][-]
  1. bc@red test$ nano helloworld.txt
What you showed is not the same case.

You are right that you can tell FPC to compile a file with whatever extension you can dream of.  That's a very  different case than the compiler having to _search_ for the source code of a unit.  In that case, it cannot search for just any extension, it has to search for a set of extensions that are those a unit source is supposed to have, e.g, .pas, .pp.  Otherwise, it would accept an executable file that happens to have the same name as a unit and, that would make no sense at all (fortunately, the compiler doesn't try that.)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

cdbc

  • Hero Member
  • *****
  • Posts: 2264
    • http://www.cdbc.dk
Re: WinInet compiling errors.
« Reply #11 on: June 21, 2025, 11:08:06 am »
Hi
Ok, but isn't that Lazarus' problem then, as far as I'm aware, the compiler just does what it's told (by Lazarus)...  %)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: WinInet compiling errors.
« Reply #12 on: June 21, 2025, 11:13:57 am »
Hi
Ok, but isn't that Lazarus' problem then, as far as I'm aware, the compiler just does what it's told (by Lazarus)...  %)
Regards Benny
Lazarus didn't tell FPC anything about the wininet unit.  FPC decided all by itself that wininet.lpr was the source code for the wininet unit.  I don't think FPC should do that.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

korba812

  • Sr. Member
  • ****
  • Posts: 476
Re: WinInet compiling errors.
« Reply #13 on: June 21, 2025, 11:14:20 am »
I'm guessing that there are .o files left over from the wininet.lpr project in the lib\x86_64-win64 directory and the linker takes that file.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12326
  • FPC developer.
Re: WinInet compiling errors.
« Reply #14 on: June 21, 2025, 11:19:37 am »
I am a bit surprised that the compiler doesn't seem to take the extension into account.  I don't think a .lpr file is ever supposed to be a unit.  Am I mistaken about that ?

The extensions are mostly convenience functions. The only thing the compiler knows is a list of extensions to test if you pass a name without extension.

And I would also bet on Korba812's analysis, some leftover files of a past .lpr compilation override the shipped wininet precompiled .o

 

TinyPortal © 2005-2018