IForeClass.BindToMethod

Syntax

BindToMethod(MethodName: String): IForeSub;

Parameters

MethodName. Procedure/function name.

Description

The BindToMethod method returns information about procedure/function with the specified name.

Comments

The method returns Null if a procedure/function with the specified name in the current structure is not found.

Example

Executing the example requires that the repository contains an assembly with the ASSM_TEST identifier. The CCalculate class is implemented in the assembly, the class contains the Calculate function.

Add a link to the Fore, Metabase system assembly.

Sub UserProc;
Var
    ForeService: IForeServices;
    Runtime: IForeRuntime;
    Assm: IForeAssembly;
    FClass: IForeClass;
    FSub: IForeSub;
Begin
    ForeService := MetabaseClass.Active 
As IForeServices;
    Runtime := ForeService.GetRuntime;
    
//Load assembly
    Assm := Runtime.BindToAssembly("ASSM_TEST");
    //Get class
    FClass := Assm.BindToClass("CCalculate");
    
//Get function
    FSub := FClass.BindToMethod("Calculate");
    
//Specify class instance for which function will be executed
    FSub.Self := FClass.CreateObject;
    
//Function execution
    FSub.Invoke;
    
//Display result
    If FSub.IsResult Then
        Debug.WriteLine(FSub.ResultValue);
    
End If;
End Sub UserProc;

On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The access to the specified class function will be obtained in the assembly. The function will be executed and result of its work will be displayed to the development environment console.

See also:

IForeClass