Greetings.

I have a object that connects to a speech server, festival. In my
object, I define a function called close. This must close the socket
connection, which is done by the function close. Therefore, I am having
a problem, because simply calling close with the sin and sout parameters
results in an error because it is calling my objects close function
which takes no parameters.

How can I call a function that is not part of my object, but has the
same name as one of my object functions? Here is my simple code, for
example:

function TFestival.Open(host : string; port : integer) : integer;
var
    h : THost;
    addr : TInetSockAddr;
begin
    h.NameLookup(host);
    if h.LastError <> 0 then
      begin
        Open := 1;
        Exit;
      end;
        
    addr.family := AF_INET;
    addr.port   := ShortHostToNet(port);
    addr.addr   := HostTonet(longint(h.IPAddress));
    
    sock := Socket(AF_INET, SOCK_STREAM, 0);
    if Not Connect(sock, addr, sin, sout) then
      begin
        Open := 2;
        Exit;
      end;
    
    rewrite(sout);
    reset(sin);
    
    Open := 1;
end;

procedure TFestival.Close();
begin
    close(sin);
    close(sout);
    
    Close := 0;
end;

I realize that I can simply rename my close procedure but I imagine that
I will run into similar situations as I continue to use Free Pascal.

Thank you for your help,

Jeremy



_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to