IForeAssembly.BindToSub

Syntax

BindToSub(SubName: String): IForeSub;

Parameters

SubName. The procedure/function anme implemented in the assembly global namespace.

Description

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

Comments

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

Example

Executing the example requires that the repository contains an assembly with the ASSM_TEST identifier. The Run function is implemented in the global namespace of assembly.

Add links to the Fore, Metabase system assemblies.

Sub UserProc;
Var
    ForeService: IForeServices;
    Runtime: IForeRuntime;
    Assm: IForeAssembly;
    FSub: IForeSub;
Begin
    ForeService := MetabaseClass.Active 
As IForeServices;
    Runtime := ForeService.GetRuntime;
    
//Load assembly
    Assm := Runtime.BindToAssembly("ASSM_TEST");
    //Get function
    FSub := Assm.BindToSub("Run");
    FSub.Invoke;
    
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 Run function will be obtained and launched for execution in the assembly. The result of function work will be displayed to the development environment console.

See also:

IForeAssembly