Studio:How do I access an array in the parameter list through Perl?

From STRIDE Wiki
Revision as of 11:08, 29 February 2008 by Timd (talk | contribs)
Jump to: navigation, search

By using a simple interface such as:

void test1(char s[10]);
#pragma scl_function(test1)


The following Perl script example illustrates how to access an array in the parameter list. The following example sets element 0 of s to 15.

 my $test = $ascript->Functions->Item("test1")->User;
 my $data = $test->ParameterList;
 $data->SetProperty("s", 0, 15);
 $test->Call();


Another option is to use safearray to directky copy a Perl array into an array of the parameter list. Here is an example:

my @a = (11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
$user->ParameterList->a->seq_num->{SafeArray} = \@a;
$user->Call();