Params: IForeSubParams;
The Params property returns method parameter collection.
Executing the example requires a unit with the MODULE identifier. In the unit global namespace the function is implemented:
Function Calculate(a, b: Integer; c: Double): Double;
Var
Result: Double;
Begin
//...
//Calculate taking into account parameter values
//...
Return Result
End Function Calculate;
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FSub: IForeSub;
Params: IForeSubParams;
Param: IForeSubParam;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Assm := Runtime.BindToAssembly("MODULE");
//Get function
FSub := Assm.BindToSub("Calculate");
//Set parameter values
Params := FSub.Params;
Param := Params.ParamByName("a");
Param.Value := 1;
Param := Params.ParamByName("b");
Param.Value := 2;
Param := Params.ParamByName("c");
Param.Value := 3.14;
//Execution
FSub.Invoke;
//Get information about result
Debug.WriteLine(FSub.ResultName);
Debug.WriteLine(FSub.ResultType);
Debug.WriteLine(FSub.ResultValue);
End Sub UserProc;
On executing the example, the specified unit is loaded to execution environment. The Calculate function will be obtained and its parameter values will be set. After that the function will be executed. information about executed result will be displayed to the development environment console.
See also: