Board index » delphi » Re: Library working with TStream

Re: Library working with TStream


2006-11-21 08:07:08 PM
delphi17
"Beto Neto" <XXXX@XXXXX.COM>wrote in
Quote
Hi friends...

I need to create a Library what has a exported method what will
receive a TStream as parameter...

Is possible?



To be used by who/what program/language etc.
In short yes it is possible for delphi only programs.
Take a look on IStream from more enviroments like VB
C/C++ etc.
Regards
Yannis.
 
 

Re: Library working with TStream

Hi friends...
I need to create a Library what has a exported method what will receive a
TStream as parameter...
Is possible?
 

Re: Library working with TStream

Can I write here a sample, how to make.
I'm trying this, but a exception, Invalid pointer operation, raises:
LIBRARY
procedure CopyStream(Stream: IStream); stdcall;
var
SI: TStreamAdapter;
S: TFileStream;
begin
S := TFileStream.Create('IStream.txt', fmCreate);
SI := TStreamAdapter.Create(S);
S.CopyFrom(SI.Stream, SI.Stream.Size);
SI.Free;
S.Free;
end;
exports
CopyStream;
PROGRAM
procedure CopyStream(S: IStream); stdcall; external 'StreamLib.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
S: TStream;
SI: TStreamAdapter;
begin
S := TFileStream.Create('C:\DataSource\jjwsuporte.fbk', fmOpenRead);
SI := TStreamAdapter.Create(S);
CopyStream(SI);
SI.Free;
S.Free;
end;
"Yannis" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
"Beto Neto" <XXXX@XXXXX.COM>wrote in
news:XXXX@XXXXX.COM:

>Hi friends...
>
>I need to create a Library what has a exported method what will
>receive a TStream as parameter...
>
>Is possible?
>
>
>

To be used by who/what program/language etc.

In short yes it is possible for delphi only programs.
Take a look on IStream from more enviroments like VB
C/C++ etc.

Regards
Yannis.