I'm using a TMemoryStream and I need to pass it to var TStream procedure (external lib). I just cast my TMemoryStream to TStream like this:
var
myStream: TMemoryStream;
begin
//...
ExternalProcedure(TStream(myStream)); //procedure ExternalProcedure(var AStream: TStream);
end;
Is this something to avoid? Does it take a lot of extra memory (the stream in question can be several MB)? My guess is no, but not 100% sure in Delphi.