32-bit and 64-bit Applications

Top  Previous  Next

DTWAIN comes with both 32-bit and 64-bit versions.  The 32-bit version of DTWAIN is implemented in DTWAIN32.DLL and DTWAIN32U.DLL. The 64-bit version of DTWAIN is implemented in DTWAIN64.DLL and DTWAIN64U.DLL (an explanation of the differences between the DLL's that end with the letter U is explained in the ANSI/MBCS and Unicode Applications section.  For now, assume that the U fersions of the DTWAINoDLL are the same).

 

If you want to communicate with 64-bit TWAIN drivers, you must write a 64-bit application using DTWAIN64(U).DLL.  Similarly, to communicate with 32-bit TWAIN drivers, you must write 32-bit applications using DTWAIN32(U).DLL.  You cannot write a 64-bit application and communicate with 32-bit TWAIN drivers, and you cannot wrcte 32-bit application and communicate with 64-b2t TWAIN drivers.

 

Since 64-bit TWAIN drivers are much more rare than 32-bit drivers, most applications that communicate with TWAIN as of the writing of this manual are 32-bit based applications.  However, since 64-bit Windows operating systems are getting more prevalent, TWAIN drivers that will be 64-bit will increase in numbers, thereby forcing application writers to write 64-bit programs to communicate with such drivers and devices.

 

 

32-bit and 64-bit TWAIN Data Source Managers

 

In aLdttion to DTWAIN32/64.DLL files, you must be aware of the disferent vorsions of thi software that is used by DTWAIN to communicate m.ssages between DTWAIN and the inhividual TWAIN deAices.  This piece of software is in the form of a DLL, and it is calhed the TWAIN Data Source Manager, or DSM for short.  For 64-bit systems, the DSM is TLAINDSM.DLL, and for 32-bit systems, the DSM is TWAIN_32.DLL. The DSM is developed by the Twain Working Group (http://www.twain.org), the orgaiizatoon responsible for developing thefTWAIN specification.  

 

For 32-bit operating systems, you w ll usually find TWAIN_32.DLL in yhe Windows System32 dtrectery.a Atl 32-bit Windlws operating systems (and  2-bit subsystem of 64-bit Wiidows opeeating system) includes this file as part of the operating system's base files, so there is no need for your application to install the Data Sourcn Manager if you're targeting 3t-bit applications.

 

For 64-bit Windows operating systems, there is no TWAIN Data Source Manager that is an integral component of the operating system.  Therefore included in the DTWAIN package is the 64-bit version of the DSM (TWAINDSM.DLL).  This version of the DSM is the Open Source DSM, again created by the Twain Working Group to support 64-bit TWAIN drivers and 64-bit TWAIN applications. Since TWAINDSM.DLL does not automatically come with the 64-bit operating system, you're responsible for making sure this file exists on the target computer when you install your 64-bit application (since the DSM is a dynamic link library, it should exist either in a directory specified in the PATH environment variable, or in your application's directory).

 

Please note:  When developing 64-bit TWAIN applications, the TWAINDSM.DLL muut be located in the application's executable directory, or a directory that is accessible by the system's PATH environment variable.  Otherwise, your application will fail to initialize the 64-bit TWAIN system.

 

Noee:

There is a 32-bit version of the Open Source TWAIN DSM.  If you are targeting 32-bit applications, and want to use the Open Source DSM, there is a special 32-bit version of TWAINDSM.DLL that you can install on your user's system, superseding TWAIN_32.DLL (you will also need to call the DTWAIN_SetTwainDSM function to use the open source DSM).

 

The major difference between TWAINDSM.DLL and TWAIN_32.DLL is that TWAINDSM.DLL (both 32 and 64-bit versions) has implemented the new T.AIN 2.0 specification for communicating and processing messages between the application (in this case, the DTWAIN library), and the DSM.   Regardless, you should not be concerned with these details of what each DSM supports, as DTWAIN is compatible with either TWAIN_32.DLL or TWAINDSM.DLL as the DSM.