Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
Il 16/01/23 22:23, Mattias Gaertner via fpc-pascal ha scritto: On Mon, 16 Jan 2023 22:12:52 +0100 Mattias Gaertner via fpc-pascal wrote: On Mon, 16 Jan 2023 19:50:34 +0100 Giuliano Colla via fpc-pascal wrote: I stumbled into a problem I don't understand. I'm developing a little program

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
Il 16/01/23 20:58, Marco van de Voort via fpc-pascal ha scritto: On 16-1-2023 20:56, Giuliano Colla via fpc-pascal wrote: No chance. Addr is a pointer (of type Pin_addr) but Addr := Pin_addr(HostEnt.h_addr^) works only if mode is Delphi. In objfpc it raises exactly the same error. A

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Mattias Gaertner via fpc-pascal
On Mon, 16 Jan 2023 22:12:52 +0100 Mattias Gaertner via fpc-pascal wrote: > On Mon, 16 Jan 2023 19:50:34 +0100 > Giuliano Colla via fpc-pascal wrote: > > > I stumbled into a problem I don't understand. > > > > I'm developing a little program for an ftp client. In order to > > connect to the

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Mattias Gaertner via fpc-pascal
On Mon, 16 Jan 2023 19:50:34 +0100 Giuliano Colla via fpc-pascal wrote: > I stumbled into a problem I don't understand. > > I'm developing a little program for an ftp client. In order to > connect to the site I need the site address from the site name, and > the libc gethostbyname() provides

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Marco van de Voort via fpc-pascal
On 16-1-2023 20:56, Giuliano Colla via fpc-pascal wrote: No chance. Addr is a pointer (of type Pin_addr) but Addr := Pin_addr(HostEnt.h_addr^) works only if mode is Delphi. In objfpc it raises exactly the same error. A little bit weird, isn't it? It depends. It assumes .h_addr is

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
Il 16/01/23 20:32, Michael Van Canneyt ha scritto: On Mon, 16 Jan 2023, Giuliano Colla via fpc-pascal wrote: .I stumbled into a problem I don't understand. Should that not simply be Addr := Pin_addr(HostEnt.h_addr^) (if addr is a pointer) or addr:=Pin_addr(HostEnt.h_addr^)^ if Addr

Re: [fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Michael Van Canneyt via fpc-pascal
On Mon, 16 Jan 2023, Giuliano Colla via fpc-pascal wrote: I stumbled into a problem I don't understand. I'm developing a little program for an ftp client. In order to connect to the site I need the site address from the site name, and the libc gethostbyname() provides the required

[fpc-pascal] Why in {$mode delphi} it works and in {$mode objfpc} it doesn't?

2023-01-16 Thread Giuliano Colla via fpc-pascal
I stumbled into a problem I don't understand. I'm developing a little program for an ftp client. In order to connect to the site I need the site address from the site name, and the libc gethostbyname() provides the required information. gethostbyname returns a PHostEnt type which is declared