Entry Point

The entry point is a procedure named Main that will be run for execution on running the assembly or unit. The procedure may initialize any forms or run other code for execution.

The Main procedure must be placed in global namespace and not have any input parameters. Any access modifiers can be present. To get access to repository, use the MetabaseClass.Active property. To get the unit or form, which code is currently being executed, use the ModuleClass.Active static property.

Sub Main;
Var
    Mb: IMetabase;
    MObj: IMetabaseObjectDescriptor;
Begin
    
//Get repository access
    Mb := MetabaseClass.Active;
    //Get object description
    MObj := Mb.ItemById("Report");
    
//...
    // Further work with object and repository
    //...
End Sub Main;

See also:

Creating An Assembly