0
votes

My old Delphi 7 application is using IdStreamVCLWin32 unit in one pas file. This unit is located at following location.

C:\Program Files\Indy 10 for Delphi\Source\System\IdStreamVCLWin32.pas

When I am running same code in my Delphi XE4 environment, I am getting error IdStreamVCLWin32 not found.

Note: Delphi 7 is using Indy 10 but Delphi XE4 is using Indy which comes default with it. I have not installed indy explicitly in Delphi XE4 environment.

I searched my entire C drive where Delphi XE4 is installed but found no IdStreamVCLWin32.pas file.

How to get rid from this error?

1

1 Answers

1
votes

From what I can tell, you were never meant to include that unit directly. The unit IdStreamVCL would delegate to either IdStreamVCLDotNet or IdStreamVCLWin32. And so it appears to me that IdStreamVCLWin32 is an implementation detail that you are shielded from by using IdStreamVCL.

These units have, nowadays, all been coalesced into IdStreamVCL. And so you could include that. However, it's not clear to me that you should even do that. Take a look at IdStream:

unit IdStream;

interface

{$I IdCompilerDefines.inc}

uses
{$IFDEF DOTNET}
  IdStreamNET
{$ELSE}
  IdStreamVCL
{$ENDIF};

type
{$IFDEF DOTNET}
  TIdStreamHelper = TIdStreamHelperNET;
{$ELSE}
  TIdStreamHelper = TIdStreamHelperVCL;
{$ENDIF}

implementation

end.

It seems pretty clear that you are meant to use IdStream and let the compiler work out whether that implementation is provided by IdStreamNET or IdStreamVCL.

So, the answer to your question is probably that you should replace your use of IdStreamVCLWin32 with IdStream. Note that the functionality in IdStream is implemented differently now. You no longer instantiate an instance of a stream class. The modern Indy offers you a helper class TIdStreamHelper which contains class functions. So you end up writing code like this:

BytesWritten := TIdStreamHelper.Write(Stream, Bytes, Count);

However, I cannot be sure that's the right approach since I don't know what you actually use from IdStreamVCLWin32. It's quite plausible that your code uses nothing from there and the use of IdStreamVCLWin32 is simply a stray hangover from some older version of your code.

So my advice is:

  1. Remove IdStreamVCLWin32 from your uses.
  2. Deal with any subsequent compiler errors by studying the code and working out the right way to do it with the current Indy code.