Indy client in a DLL does not connect

Hello,

    Can anyone tell me what is going on my application? I've implemented a
very simple client (TIdTCPClient) on my application and it worked fine
comunicating with the server. Then I created a DLL with this procedure like
the code bellow:

function IPComm(s: PChar): PChar;
begin
 with TIdTCPClient.Create(nil) do
 try
  Host := '127.0.0.1';
  Port := 8090;
  Connect;
  try
   Writeln(s);
   Result := PChar(ReadLn);
  finally
   Disconnect;
  end;
 finally
  Free;
 end;
end;

    Another application calls this function from the DLL but the connection
to winsock is not made. I cannot talk to the server. What is missing?

    thanks,

    Marco Castro