38.7.1. Native API technology


<< Prev   Next >>

Native API add-ins can be attached both in client applications and on 1C:Enterprise application server.

When an add-in is operating on the server, the AttachAddIn() call needs to be executed every time before creating an add-in instance, since in general, it cannot be predicted on which server the call will be made (it can be Windows, Linux, 32-bit or 64-bit OS).

38.7.1.1. Add-in installation on the client

InstallAddIn("CommonTemplate.BarcodeScannerDriver");

38.7.1.2. Loading from file on hard drive

The add-in file must be located on the user's computer and be available in the search path (PATH environment variable) of the operating system.

SysInfo = New SystemInfo;

If SysInfo.PlatformType = PlatformType.Windows_x86 Then
AttachAddIn("AddInCPP.dll", "MyName", AddInType.Native);
ElseIf SysInfo.PlatformType = PlatformType.Windows_x86_64 Then
AttachAddIn("AddInCPP64.dll", "MyName", AddInType.Native);
ElseIf SysInfo.PlatformType = PlatformType.Linux_x86 Then
AttachAddIn("libAddInCPP.so", "MyName", AddInType.Native);
Else
AttachAddIn("libAddInCPP64.so", "MyName", AddInType.Native);
EndIf;

AddInObject = New("AddIn.MyName.ComponentExtension");

38.7.1.3. Load add-in from template

SysInfo = New SystemInfo;

If SysInfo.PlatformType = PlatformType.Windows_x86 Then
AttachAddIn("DataProcessor.AddIn.Template.AddInWindows32", "MyName", AddInType.Native);
ElseIf SysInfo.PlatformType = PlatformType.Windows_x86_64 Then
AttachAddIn("DataProcessor. AddIn.Template.AddInWindows64", "MyName", AddInType.Native);
ElseIf SysInfo.PlatformType = PlatformType.Linux_x86 Then
AttachAddIn("DataProcessor.AddIn.Template.AddInLinux32", "MyName", AddInType.Native);
Else
AttachAddIn("DataProcessor. AddIn.Template.AddInLinux64", "MyName", AddInType.Native);
EndIf;

AddInObject = New("AddIn.MyName.ComponentExtension");

38.7.1.4. Loading from infobase

The infobase must contain the AddIns catalog and attributes for the specified names of the ValueStorage type with add-in files.

Variable Ref;

SysInfo = New SystemInfo;

If SysInfo.PlatformType = PlatformType.Windows_x86 Then
Ref = GetURL(Catalogs.AddIns.FindByCode("000000001"), "AddInWindows32");
ElseIf SysInfo.PlatformType = PlatformType.Windows_x86_64 Then
Ref = GetURL(Catalogs.AddIns.FindByCode("000000001"), "AddInWindows64");
ElseIf SysInfo.PlatformType = PlatformType.Linux_x86 Then
Ref = GetURL(Catalogs.AddIns.FindByCode("000000001"), "AddInLinux32");
Else
Ref = GetURL(Catalogs.AddIns.FindByCode("000000001"), "AddInLinux64");
EndIf;

AttachAddIn(Ref,"MyName", AddInType.Native);
AddInObject = New("AddIn.MyName.ComponentExtension");

In these examples of operating Native API add-ins, you can also attach add-ins developed using COM technology only for Windows OS.

38.7.1.5. Attaching add-ins from ZIP archives

The configuration must contain the common BarcodeScannerDriver template of the BinaryData type. This template stores a specially structured ZIP archive that contains add-ins for all supported operating systems, browsers, and processor architectures.

AttachAddIn("CommonTemplate.BarcodeScannerDriver", "Scanner");
AddIn = New("AddIn.Scanner.BarcodeScanner");

38.7.1.6. Attaching add-ins in isolated mode

The configuration must contain the common AddIn template of the BinaryData type. This template stores a specially structured ZIP archive that contains add-ins for all supported operating systems, browsers, and processor architectures. An add-in to be attached must support the isolated attachment mode. Otherwise, an exception is thrown.

AttachAddIn("CommonTemplate.AddIn", "AddIn", , AddInAttachmentType.Isolated);
AddIn = New("AddIn.AddIn.BarcodeReader");

<< Prev   Next >>

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002