J,
You need more information about the function that is contained in the IDL or
the type library. Unfortunately, not all COM objects have an IDL file or
type library.

Both the IDL file and the type library would tell us exactly what the "*"
means in C because it is ambiguous. The "*" could mean we are passing a
single value by reference, or multiple values.

I can tell you that it is not looking for a variant, however.

Often COM uses a special data structure called a SAFEARRAY to pass arrays so
it could be that your function is looking for scalars, not arrays.

Perhaps there is some documentation?

S

-----Original Message-----
From: J aperlh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 01, 2005 8:44 PM
To: beginners@perl.org
Subject: Argument passing between perl and a C function.

Argument passing between perl and C function.


There is C function in a OLE server:
What kind of variable should I pass to this function?
#########################################################################
BOOL Calculate(BSTR* names, double* values, short number_of_names);


I tried the following script, but there is always an error like "Type
mismatch" ...
Is there any simple way to pass argument between perl and C function?
#########################################################################
#! perl -W


use strict;
use Win32::OLE;
use Win32::OLE::Variant;


my $names = Variant(VT_BSTR|VT_ARRAY, 3);
my $values = Variant(VT_R8|VT_ARRAY, 3);


$names->Put(['name1', 'name2', 'name3']);
$values->Put([0, 0, 0]);


my $ret = $app->Calculate($names, $values, 3);

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to