> ## 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.

# Step 1: Load FlexiCapture 12 SDK

To start your work with ABBYY FlexiCapture 12 SDK you need to create the [**Engine**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/engine.md) object. The **Engine** object is the top object in the hierarchy of the ABBYY FlexiCapture 12 SDK objects and is the only ABBYY FlexiCapture 12 SDK externally creatable object.

To load the **Engine** object, do the following.

1. Create the [**EngineLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iengineloader.md) object using the [**GetEngineLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/getengineloader.md) exported function. The [**EngineLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iengineloader.md) object provides access to the settings required during the **Engine** object initialization.
2. Set up all the necessary parameters using the [**EngineLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iengineloader.md) object properties. The *CustomerProjectID* is a required property. You can set the path to the online licensing file, the corresponding password and a path to the folder, in which ABBYY FlexiCapture 12 SDK should store user-specific data if needed.
3. Call the [**GetEngine**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iengineloader-getengine.md) method of the [**EngineLoader**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/iengineloader.md) object and receive the reference to the **Engine** object.

> [accordion] C++ (COM) code
>
> ```cpp theme={null}
> // HANDLE to FCEngine.dll
> static HMODULE s_libraryHandle = 0;
>
> BOOL loadEngine()
> {
>     // First step: load FCEngine.dll
>     if( s_libraryHandle == 0 ) {
>         s_libraryHandle = LoadLibraryEx( ::GetDllPath(), 0, LOAD_WITH_ALTERED_SEARCH_PATH );
>         if( s_libraryHandle == 0 ) {
>             return FALSE;
>         }
>     }
>
>     // Second step: obtain Engine Loader
>     typedef HRESULT ( STDAPICALLTYPE* EngineLoaderFunc )( FCEngine::IEngineLoader** );
>     EngineLoaderFunc pEngineLoader =
>         (EngineLoaderFunc)GetProcAddress( s_libraryHandle, "GetEngineLoader" );
>
>     if( pEngineLoader == 0 ) {
>         return FALSE;
>     }
>
>     HRESULT hResult = pEngineLoader( &EngineLoader );
>     if( FAILED( hResult ) ) {
>         IErrorInfo* errorInfo;
>         ::GetErrorInfo( 0, &errorInfo );
>         _com_raise_error( hResult, errorInfo );
>     }
>
>     // Third step: set required parameters and load the Engine
>     EngineLoader->put_CustomerProjectId( ::GetCustomerProjectId() );
>     EngineLoader->put_LicensePath( ::GetLicensePath() );
>     EngineLoader->put_LicensePassword( ::GetLicensePassword() );
>     Engine = EngineLoader->GetEngine();
>
>     return TRUE;
> }
> ```

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).

Received in such a way, the **Engine** object is a singleton, so only one object of this type may be created in a single instance of the application that uses ABBYY FlexiCapture SDK. Repeated attempts to create the **Engine** object will return the same object. It is important to notice that the process of creation of the **Engine** object takes rather long time because it requires loading not only the FCEngine.dll, but a whole set of other DLLs.

> [!NOTE]
>
> .NET developers must make sure to specify \[STAThread] (single-threaded apartment model) оr \[MTAThread] (multi-threaded apartment model) as an attribute on the application main function, otherwise an error may occur:

```csharp theme={null}
[STAThread]
public static void Main()
{
  ...
}
```

It is recommended to use the \[STAThread] because it is now more accepted.

If your license has expired, the **Engine** object will be created but only the [**StartLogging**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/engine-startlogging.md), [**StopLogging**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/engine-stoplogging.md) methods of the **Engine** object will be available. Other methods of the **Engine** object will return CLASS\_E\_NOTLICENSED error code.

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

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

After creating the **Engine** object, you can use ABBYY FlexiCapture 12 SDK objects in your application. The next step is to [open a FlexiCapture project](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/engine-openingproject.md) which contains the Document Definitions and other settings you will use for processing.

## Additionally

ABBYY FlexiCapture 12 SDK provides [two more methods for loading the Engine object](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/differentwaystoloadengine.md), which allow you to work with the Engine in different threads.

More information on loading ABBYY FlexiCapture SDK in applications written in other programming languages:

* [Delphi](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/delphi.md)
* [Java](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/usinginjava.md)
* [Scripting languages](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/scriptlanguages.md)
* [General recommendations](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/programmingaspects.md)

## See also

[Step 2: Open Project](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/engine-openingproject.md)
