---------------------------------------------------------------------------
Thanks for you guys help.

There is an application written in C language by my colleague.
We are not allowed to share this application for security reason.

What I am going to do is to call a set of functions in this
application (OLE server) from a PERL script (OLE controller).

So far, all the functions are works well, except a reference(pointer)
related functions:
---------------------------------------------------------------------------
BOOL Calculate(BSTR* names, double* values, short number_of_names);
names: a list of names
values: a list of corresponding values,
number_of_names: size of the array

I don't know that I should pass to this funtion.
Array reference or something else?

I know that if the OLE controller is in C language, things will be easier,
Passing the first element of the array to this function is ok



On 6/3/05, Siegfried Heintze <[EMAIL PROTECTED]> wrote:
> 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