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:

GC.Collect()
GC.WaitForPendingFinalizers()
    

You can use the StartLogging method of the Engine object to get the list of objects that have not been deleted.

Objects and their properties

Important! 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 for details.

Also in this section

The detailed description of loading and unloading ABBYY FlexiCapture SDK.

Peculiarities of using in server applications.

Information about error handling.

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.

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.

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

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

The description of the initialization and deinitialization procedure in Delphi.

The description of how to use FlexiCapture SDK in Java.

24.03.2023 8:48:38

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.