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 as:
Show quoted text 12 lines
Actually the chars h_addr points to are /hlength/ bytes to be interpreted as an /in_addr/
In order to recover h_addr I have a line which works perfectly in Delphi mode (inherited from an old Kylix app):
Addr := Pin_addr(HostEnt.h_addr^);
I believed that in objfpc mode it was sufficient to change it in
Addr := @(Pin_addr(HostEnt.h_addr^));
or in
Addr := Pin_addr(@HostEnt.h_addr^);
but such is not the case. In both cases it flags the line with the same error, i.e.:
Error: illegal qualifier
Hint: may be pointer dereference is missing
Fatal: Syntax error, ")" expected but "identifier H_ADDR" found
What I'm missing? How should i write that line of code to make it work in objfpc mode?
Thanks,
Giuliano
