next up previous contents index
Next: Module Development Kit Up: Modules API Previous: Modules API   Contents   Index


Modules in brief

There are some things to say about modules that apply to all types.

Upon loading a shared object file, GOCR tries to call a function with the following prototype:

int gocr_initModule ( void );
so, if you need to initialize some data, just declare this function. If the function returns something different than 0, it's assumed that some error occured, and the module package is imediately closed.

Similarly, when a module package is closed, GOCR tries to call

void gocr_closeModule ( void );
which you can use to free memory, etc.3.1

Besides these two functions, there's a third function, also optional, that may be used to set attributes in real time:

int gocr_setAttribute ( char *field, char *data );
The first argument, field, is the attribute name. The second, data, is the value that the attribute should be set to.

Note that all the three functions are optional, and do not need to be declared. You may use whichever you need (e.g., you may declare gocr_closeModule without gocr_initModule).

Besides these functions, there are variable that your code must export, containing information about your module:

gocrModuleInfo gocr_externalModuleData;
which is a structure of the following format:



Subsections
next up previous contents index
Next: Module Development Kit Up: Modules API Previous: Modules API   Contents   Index
root 2002-02-17