2.4.2.2 Passing Variables To and From Origin C Functions

When calling a function of any type it is often necessary to pass variables to that function and likewise receive variables output by the function. The following summarizes the syntax and characteristics of passing LabTalk variables to Origin C functions.

Sytnax for calling Origin C Function from LabTalk

Origin C functions are called from LabTalk with sytnax such as:

// separate parameters by commas (,) if more than one
int iret = myfunc(par1, par2....); 

// no need for parentheses and comma if there is no assignment
myfunc par1; 

// function returns no value, and no parameter, parentheses optional
myfunc;

Variable Types Supported for Passing To and From LabTalk

The following table lists Origin C variable types that can be passed to and from LabTalk when calling an Origin C Function:

Variable Type Argument to OC Function Return from OC Function
double Yes Yes
int Yes Yes
bool (true or false) No, pass int instead, 0 for false, and other integer for true. No, return int instead, 0 for false, 1 for true.
string Yes Yes
int, double array Yes Yes
string array Yes, but cannot pass by reference Yes
DataRange Yes, but only for column level range, other range can be passed by string No
Tree Yes Yes

Note:

  1. The maximum number of arguments that Origin C function can have to call from LabTalk is 80.
  2. LabTalk variables can be passed to Origin C numeric function by reference.