Board index » delphi » Huge data as a parameter

Huge data as a parameter

Hello!

I need to define an OLE interface with two methods, one for read binary data
and the other for writing binary data. How must I define the parameter? Is
this ok?

Read(byte* iDat; ...);
Write(byte** oData; ...);

Thanks!

 

Re:Huge data as a parameter


Probably the easiest way is to define the interface using a Variant.  So,
like this in the IDL speak:

 interface Interface1: IDispatch
{
  [id(0x00000001)]
  HRESULT _stdcall Read([in] VARIANT iData );
  [id(0x00000002)]
  HRESULT _stdcall Write([out] VARIANT * oData );

Quote
}

or, in the Object Pascal speak:

Interface1 = interface(IDispatch)
  [ uuid '{D8BDC861-74B4-11D5-BFA8-00B0D017C4CD}',
    version 1.0,
    dual,
    oleautomation ]
  procedure Read(iData: OleVariant) [dispid $00000001]; safecall;
  procedure Write(out oData: OleVariant) [dispid $00000002]; safecall;
end;

When you create the OleVariant with VarArrayCreate, you can pass it the
VarData value of varByte, which tells it to create a SafeArray that stores
bytes.  Then you can write the data stream into the variant (or read it out
from the variant, depending on your function).

Hope this helps!
Ed

Quote
"David Sancho" <otroscorr...@terra.es> wrote in message

news:3b4a0813$1_2@dnews...
Quote
> Hello!

> I need to define an OLE interface with two methods, one for read binary
data
> and the other for writing binary data. How must I define the parameter? Is
> this ok?

> Read(byte* iDat; ...);
> Write(byte** oData; ...);

> Thanks!

Other Threads