This function is used to get a pointer to the IEngine interface. It provides easy access to online licensing if needed and also allows you to specify some additional parameters during initialization. It takes as an input parameter the Customer Project ID number, which is an alphanumeric string common to all the Developer and Runtime licenses your project uses.
HRESULT __stdcall InitializeEngine( BSTR CustomerProjectID, BSTR LicensePath, BSTR LicensePassword, BSTR FREngineDataFolder, BSTR FREngineTempFolder, VARIANT_BOOL IsSharedCPUCoresMode, IEngine** Engine );
- [in] A string containing the Customer Project ID.
Note: During library initialization the list of all available licenses is searched for a Developer or Runtime License corresponding to this Customer Project ID. If no corresponding license is found, an error for the last checked license will occur. However, you may pass 0 for this parameter and select the license later, by calling the IEngine::SetCurrentLicense method before any other library methods.
- [in] The full file name of the Online License file. If you do not use an Online License, pass an empty string "" or a Null pointer instead.
- [in] The Online License password. If you do not use an Online License, pass an empty string "" or a Null pointer instead.
- [in] Contains the path to the folder in which ABBYY FineReader Engine should store user-specific data. By default, for automatic installation:
/var/lib/ABBYY/SDK/12/FineReader Engine for auxiliary engine data
/var/lib/ABBYY/SDK/12/Licenses for license data
If you set the FREngineDataFolder value, all auxiliary information will be written to a new data folder. You may need to change the default value, for example, if the interface language settings for your application must be different from other applications that use FineReader Engine. After changing the default, make sure you have full control permissions on the new data folder.
- [in] Contains the path to the folder for ABBYY FineReader Engine temporary files. By default, it is /tmp/ABBYY FineReader Engine 12 folder.
- [in] Specifies whether the CPU cores should be used in shared mode. There are two modes of CPU cores usage: separate and shared. In separate mode ABBYY FineReader Engine uses no more processes than it is allowed by the license. In shared mode any number of processes can be run, but all these processes will use only the CPU cores specified by the IMultiProcessingParams::SharedCPUCoresMask property.
- [out, retval] A pointer to IEngine* pointer variable that receives the interface pointer to the resulting Engine object.
The function may return the standard return values of ABBYY FineReader Engine functions.
Only one Engine object may be created using this function in a single instance of the application that uses ABBYY FineReader Engine. Repeated attempts to create the Engine object will return the same object.
Important! Please notice that the process of creation of the Engine object takes rather long time because it requires loading not only the libFREngine.so, but a whole set of other dynamic libraries. Intensive networking with the license server can take long in case you use network license. Make sure that your network performance meets requirements: for sufficiently rapid work with network license speed 100 Kb/s and more is required.
It is possible to create and run the Engine object on a multi-processor system, but there can be only one Engine object in each process. A second call to InitializeEngine within the same process will return the reference to the existing object. Therefore, you should create a separate Engine object for each process by calling the InitializeEngine function.
It is prohibited to initialize and deinitialize ABBYY FineReader Engine at the entry points of other dynamic libraries, and also in constructors and destructors of static and global objects implemented in dynamic libraries, because they are called at the dynamic library entry points. A user should initialize and deinitialize ABBYY FineReader Engine elsewhere, for example, in main function of an executable module.
During initialization ABBYY FineReader Engine will reset the LC_CTYPE setting to operating system defaults. This fact should be taken into account if your application depends upon locale-dependent services.
You should pass a valid Customer Project ID number as an input parameter. However, you may choose the license which should be used for processing, by calling the SetCurrentLicense method of the Engine object before any of the processing methods. Use the GetAvailableLicenses method to look through the list of the available activated licenses you may use, and the CurrentLicense property of the Engine object to check which license is already selected for use.
The function is used in all code samples.