Different Ways to Load the Engine Object

Each of the loading methods has its own specifics affecting the use of the object in different circumstances. The first two methods are most suitable for use in interactive applications which are not intended for simultaneous processing of multiple requests. The third method is most suitable for server solutions.

Different Ways to Load the Engine Object

There are three ways to load the Engine object in ABBYY FineReader Engine 10. Each of the loading methods has its own specifics affecting the use of the object in different circumstances. The first two methods are most suitable for use in interactive applications which are not intended for simultaneous processing of multiple requests. The third method is most suitable for server solutions.

Loading FREngine.dll manually and working with “naked” interfaces

This is the standard method to load the Engine object, which was also used in the previous version of ABBYY FineReader Engine. To get a reference to the Engine object, call the GetEngineObject (GetEngineObjectEx) function.

Advantages

  • Results in maximum performance.

  • Does not require registration of FREngine.dll.

 

Limitations

  • Imposes restriction on working with multi-threaded applications.

  • When working with high-level languages (e.g. .NET), low-level means must be used to load dynamic libraries and to call functions published in them.

Loading the Engine object by means of COM into the current process

The Engine is loaded as an in-process server into the same process where the application is running. The Engineobject is loaded using the InprocLoader object, which implements the IEngineLoader interface.

Advantages

  • All ABBYY FineReader Engine objects are completely thread-safe and can be created and used in different threads.
  • When working from the Мain STA apartment, performance is the same as when working with the naked interfaces. When accessing from different threads, marshalling overhead may occur, which is negligible in most scenarios.
 

Limitations

  • Registration of FREngine.dll is required when installing the final application on an end user's computer.

 C# code

IEngineLoader engineLoader = new FREngine.InprocLoader();
IEngine engine = engineLoader.GetEngineObject(…);
try {
   
} finally {
    engineLoader.ExplicitlyUnload();
}
 Note: To register FREngine.dll when installing your application on an end-user computer, use the following command line: regsvr32.exe /c /n /i:[Path to the Inc folder] [Path to the FREngine.dll]

Loading the Engine object by means of COM into a separate process

The Engine is loaded as an out-of-process server into a separate process. The Engine object is loaded by means of the OutprocLoader object, which implements an IEngineLoader interface.

Advantages

  • All ABBYY FineReader Engine objects are completely thread-safe. Each instance of the Engine runs in a separate process parallel to the others.
  • A pool of processors can be organized to make full use of the computer's CPU power.
 

Limitations

  • There is a small marshaling overhead.
  • Registration of FREngine.dll is required when installing the final application on an end user's computer.
  • When working under accounts with limited permissions, the necessary permissions must be granted.
  • It is impossible to access a page image as HBITMAP without marshaling.

 C# code

IEngineLoader engineLoader = new FREngine.OutprocLoader();
IEngine engine = engineLoader.GetEngineObject(…);
try {
   
} finally {
    engineLoader.ExplicitlyUnload();
}
 Note:
  • Account permissions can be set up using the DCOM Config utility (either type DCOMCNFG in the command line, or select Control Panel > Administrative Tools > Component Services). In the console tree, locate the Component Services > Computers > My Computer > DCOM Config folder, right-click ABBYY FineReader 10.0 Engine Loader (Local Server), and click Properties. A dialog box will open. Click the Security tab. Under Launch Permissions, click Customize, and then click Edit to specify the accounts that can launch the application.
    Note that on a 64-bit operating system the registered DCOM-application is available in the 32-bit MMC console, which can be run using the following command line: "mmc comexp.msc /32".
  • To register FREngine.dll when installing your application on the server, use the following command line: regsvr32.exe /c /n /i:[Path to the Inc folder] [Path to the FREngine.dll]
  • We recommend that you use a Network license both for debugging your server application and for running it.

Additionally, you can manage the priority of a host process and control whether it is alive using the IHostProcessControl interface.

Comparison table

The table below sums up the characteristics of the three loading methods:

Characteristics Naked interfaces In-process server Out-of-process server
Works without proxy (no marshaling overhead) Yes There are limitations No
Works in multi-threaded applications There are limitations Yes Yes
Parallel running processes are possible (for server solutions) No No Yes
No registration of FREngine.dll required Yes No No
No running permissions must be set up Yes Yes No
Objects can be created using the new operator. Works from scripts. No Yes Yes
Ability to access a page image as HBITMAP Yes Yes No
Works in a separate process (fail-proof, recycling) No No Yes

Using from a 64-bit process

If you are going to use ABBYY FineReader Engine from a 64-bit process (e.g. ASP.NET on 64-bit servers), we recommend that you use the way of loading FineReader Engine into a separate process.

Was this article helpful?

2 out of 3 found this helpful

Have more questions? Submit a request

Recently viewed