Final Step: Unload ABBYY FlexiCapture 12 SDK

After finishing your work with ABBYY FlexiCapture 12 SDK, unload the Engine object. Use the DeinitializeEngine exported function.

C++ (COM) code

This procedure is used in the ABBYY FlexiCapture 12 SDK samples which can be found in the Samples folder (Start > Programs > ABBYY FlexiCapture 12 SDK > Code Samples Folder).

It is prohibited to deinitialize ABBYY FlexiCapture 12 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 FreeLibrary function is not re-entrant. You should deinitialize ABBYY FlexiCapture 12 SDK elsewhere, for example, in WinMain function of an EXE module.

Note: 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:


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


ABBYY FlexiCapture 12 SDK provides two other ways to load and unload the Engine object. These ways provide access to completely thread-safe objects.

Supplementary information on unloading ABBYY FlexiCapture 12 SDK in applications written in different programming languages:

See also

Step 1: Load FlexiCapture 12 SDK

15.08.2023 13:19:30

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.