[fpc-devel] Indy IdHTTP
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun May 24 09:39:27 CEST 2009
On 24 May 2009, at 04:32, ABorka wrote:
> In FPC/Lazarus:
> procedure TForm1.IdHTTP1Redirect(Sender: TObject; var dest: String;
> var NumRedirect: Integer; var Handled: Boolean; var VMethod:
> IdHTTPMethod);
> begin
> ShowMessage('Redirected to:' + dest);
> end;
>
> However, it seems that the parameter "dest" is passing a pointer to
> a pointer and not just a pointer to the string (displaying only some
> strange characters instead of the redirecting URL).
It is normal that dest is (implicitly) a pointer to a pointer. A "var"
parameter means that the address of some variable is passed to a
function, rather than only its value.
Now, an (Ansi)String is a pointer to an array of characters, with some
extra data before it. So if you have a "var" parameter of the type
(Ansi)String, you get a pointer to that "pointer to an array of
characters". Otherwise you would be unable to change the address
stored inside that pointer (you would only be able to permanently
change the data in the array it points to, but not make it point to a
different array in a way that persists after the function exits).
If you are only using Pascal code in the real program, this should all
be handled transparently for you.
Jonas
More information about the fpc-devel
mailing list