Hi,

I'm looking for the right way to convert a Win32::OLE::Variant array
into a perl array or array-ref.

The problem is in the following code-snippet:

1: $DataArray=Win32::OLE::Variant->new(VT_I2|VT_ARRAY|VT_BYREF,[0,0]);
2: GetMuxData($DataArray);
3: $data = $DataArray->Value();

Line 1: supplies a SAFEARRAY* for the following function call.
Line 2: calls a function which places about 1000000 (1e6) short int (2 
byte) values into the supplied variant $DataArray.
This uses/allocates approx 2 Meg. of memory (no surprise!).

Line 3: should convert the data array inside the variant into a 
perl-array-ref. This it does, however, it uses approx. 28 Meg. of memory 
(BIG SURPRISE!!).

So my question is, am I using the wrong way to get the 1 million data 
into my perl-hands, or is there a design-problem with using large arrays 
  and Variants?

If I can't make this more efficient (in time and memory) I have to use 
VB which is definitely not what I want!

TIA,
Thomas

-- 
-------------------------------------------------------
Dr. Thomas Bruns                  <[EMAIL PROTECTED]>

          Physikalisch-Technische Bundesanstalt
                       Braunschweig
Fachlabor: 1.13
Bundesallee 100                   Tel: 0531/592 -  1132
D-38116 Braunschweig              Fax: 0531/592-69-1132
-------------------------------------------------------

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to