Re: Problems recompiling Indy

Giganews Newsgroups
Subject: Re: Problems recompiling Indy
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Thu, 19 Jan 2006

"Ciaran Costelloe" <ccostell…@flogas.ie> wrote in message
news:4F1BE874FBE9E240ccostell…@flogas.ie...

> IdGlobal's WriteStringToStream gives a warning that LBytes
> might not have been initialised, which looks like it might be valid.

What does your copy of WriteStringToStream() look like?  Mine looks like
this:

    procedure WriteStringToStream(AStream: TIdStream; const AStr :string);
    var
        LBytes: TIdBytes;
    begin
        if AStr = '' then Exit;
        LBytes := ToBytes(AStr); // <-- always initialized!!
        TIdStreamHelper.Write(AStream, LBytes);
    end;

> Due to (good) rewrites in Indy, IdCoderTNEF won't compile because
> of TIdStreamVCL.

That's ok.  I always meant to eventually post my own TNEF implementation
anyway ;-)

Seriously, though, not every component in Indy has been updated yet to not
use TIdStreamVCL anymore - and TIdStreamVCL was removed from Indy 10 a long
time ago.

> Changing those declarations from TIdStreamVCL to TStream allows it to
compile

Do not use TStream directly.  Always use TIdStream instead, which maps to
the proper platform-specific Stream class (Tstream for the Win32 VCL).

> but gives warnings of "Constructing instance of 'TStream' containing
abstract method
> 'TStream.Read'" and the same for 'TStream.Write'.

You cannot instantiate TStream directly, for exactly the reason you have
seen - it is an abstract base class.  You must always use a descendant class
instead.

Gambit

Replies

In response to

Problems recompiling Indy posted by Ciaran Costelloe on Wed, 18 Jan 2006