Difference between revisions of "Studio:How do I access an array in the parameter list through Perl?"

From STRIDE Wiki
Jump to: navigation, search
Line 1: Line 1:
 
By using a simple interface such as:<br>
 
By using a simple interface such as:<br>
<source lang="perl">
+
<source lang="c">
void test1(char s[10]);<br>
+
void test1(char s[10]);
 
#pragma scl_function(test1)
 
#pragma scl_function(test1)
 
</source>
 
</source>

Revision as of 23:34, 7 October 2008

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 directly 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();