> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Programming Aspects

The ABBYY FlexiCapture SDK application programming interface conforms to the COM standard and can be easily used in C/C++, Visual Basic, .NET, Java, Delphi, or any other development tools supporting COM components. The Engine can be adapted for use in scripting languages like VBS, JS, Perl.

This section describes the main aspects of using ABBYY FlexiCapture SDK in applications written in different programming languages and provides references to articles which discuss related topics.

## Loading, initialization, and deinitialization

It is prohibited to initialize and deinitialize ABBYY FlexiCapture SDK at the entry points of other DLLs, and also in constructors and destructors of static and global objects implemented in DLLs, because they are called at the DLL entry points. This restriction is due to the fact that the Win32 **LoadLibrary** and **FreeLibrary** functions are not re-entrant. A user should initialize and deinitialize ABBYY FlexiCapture SDK elsewhere, for example, in **WinMain** function of an EXE module.

> [!NOTE]
>
> We highly recommend initializing the COM library by the call to the CoInitialize/CoInitializeEx function before starting to work with ABBYY FlexiCapture SDK library.

During initialization, ABBYY FlexiCapture SDK will reset the LC\_CTYPE setting of msvcrt.dll to the operating system defaults. This fact should be taken into account if your application depends upon the msvcrt.dll locale-dependent services.

The "Engine deinitialization failed" exception can be thrown during the deinitialization of the Engine object if not all of the objects which were created and used by the application have been deleted before the **Engine** object deinitialization. If you work with programming languages which do not have garbage collections (for example, C++), you must either use smart pointer classes (see the samples in C++ (COM)) or release objects that were created by creation methods when they are no longer needed. If all the objects have been deleted, the exception may be caused by the garbage collector operation. If the application is developed in Visual Basic .NET, all objects with the *Nothing* value are not deleted, they are only marked for deletion. The exact moment when the garbage collector deletes the object is not known. Therefore, you should call the following methods before the deinitialization of the **Engine** object so that the garbage collector deletes the object:

```csharp theme={null}
GC.Collect()
GC.WaitForPendingFinalizers()
```

You can use the [**StartLogging**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/engine-startlogging.md) method of the **Engine** object to get the list of objects that have not been deleted.

## Objects and their properties

> [!WARNING]
>
> A pointer to the child object's interface is valid until its parent object exists. An attempt to access a child object after its parent object is destroyed may result in an error.

Certain ABBYY FlexiCapture SDK objects have read-only object properties. Such properties cannot be changed directly in raw C++. If you want to change such a property, you need to pass a reference to the property object to a new variable, and then use this variable to change it.

Please see [Working with Properties](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/properties.md) for details.

## Also in this section

* [**Different Ways to Load the Engine Object**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/differentwaystoloadengine.md)

The detailed description of loading and unloading ABBYY FlexiCapture SDK.

* [**Using ABBYY FlexiCapture SDK in multi-threaded server applications**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/usinginserverapplications.md)

Peculiarities of using in server applications.

* [**Error Handling**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/errorhandling.md)

Information about error handling.

* [**Working with Properties**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/properties.md)

The interfaces of ABBYY FlexiCapture SDK objects have various properties and methods. The way the properties are handled in different languages is discussed in this article.

* [**Working with Collections**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/collections.md)

There are two different types of collection objects in ABBYY FlexiCapture SDK. Here you can find the distinctions of these types and an advice on how to work with them.

* [**Working with Connectable Objects**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/connectableobjects.md)

Some of the objects in ABBYY FlexiCapture SDK are so-called "connectable objects." Here you can find useful recommendations on working with such objects.

* [**Working with COM Interfaces from a Scripting Language**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/scriptlanguages.md)

The detailed description of how to useABBYY FlexiCapture SDK in a scripting language.

* [**Using ABBYY FlexiCapture SDK in Delphi**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/delphi.md)

The description of the initialization and deinitialization procedure in Delphi.

* [**Using ABBYY FlexiCapture SDK in Java**](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/usinginjava.md)

The description of how to use FlexiCapture SDK in Java.
