Overview of the DTWAIN_ARRAYs

Top  Previous  Next

The DTWAIN_ARRAY data type is used to store and retrieve a sequence of values between the application and the DTWAIN DLL.  Sometimes it is necessary to store a sequence of values in a language neutral structure.  DTWAIN uses a DTWAIN_ARRAY to store 'arrays' of values.

 

Why DTWAIN_ARRAYS?

The reason why this approach was used instead of everyday arrays is that array processing can vary between different languages.  For example, FORTRAN processes arrays differently than C or C++.  Instead of letting DTWAIN return an array, or for your application to supply an array, the values that you get or supply to DTWAIN are stored within the DTWAIN_ARRAY data type.  This makes it possible for totally alien languages that use vastly different array handling techniques to use DTWAIN, since no arrays are needed between your application and DTWAIN.

 

You can reuse a DTWAIN_ARRAY if you so desire. You can empty a DTWAIN_ARRAY and store your own values in them if you so desire.  One side-benefit of the DTWAIN_ARRAY is that you can use them as a 'dynamic array' of values, and use the DTWAIN_ARRAY functions to add, insert, delete items, etc. without having to call any image retrieval functions.

 

Memory Management

The DTWAIN DLL keeps track of all DTWAIN_ARRAYs that have been initialized with the DTWAIN_ArrayCreate function.  When DTWAIN_SysDestroy is called any DTWAIN_ARRAY that has been created an initialized is erased.  To destroy a DTWAIN_ARRAY without calling DTWAIN_SysDestroy, the DTWAIN_ArrayDestroy function is used.  This function removes all of the elements from the DTWAIN_ARRAY and returns any allocated resources used by the DTWAIN_ARRAY back to the system.  The DTWAIN_ArrayDestroy function should be called whenever a DTWAIN_ARRAY is no longer used.  If a DTWAIN_ARRAY is created by the application, or if the DTWAIN_ARRAY was created by DTWAIN and returned to the application (see below for LPDTWAIN_ARRAY), the DTWAIN_ARRAY should be destroyed by the application.

 

Differences between DTWAIN_ARRAY and LPDTWAIN_ARRAY

DTWAIN_ARRAY Storage Types

DTWAIN_ARRAY Creation and Initialization

DTWAIN_ARRAY Functions