Use 32-bit or 64-bit DLL depending on platform

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
prasadt
Posts: 3
Joined: Thu Feb 18, 2010 5:58 pm

Use 32-bit or 64-bit DLL depending on platform

Post by prasadt »

I have a C# application that I would like to either use the 32-bit or 64-bit Twain SDK dll depending on what platform it is running on. The examples provided suggest that we need to create a separate application for both. Is there a better way?

For instance, can I load the platform specific twain DLL depending on whether it is 32-bit or 64-bit? I would like to create one executive for distribution. And on startup of the application, I would like to:

if (IntPtr.Size == 8)
{
// load 64-bit version of the library
}
else
{
// load 32-bit version of the library
}
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Use 32-bit or 64-bit DLL depending on platform

Post by Alex »

Hello,

You can compile your application with version 7.0 of VintaSoftTwain.NET SDK in "Any CPU" mode
and your application will:
  • work in x32 systems with TWAIN_32.DLL or TWAINDSM.DLL (x32)
  • work in x64 systems with TWAINDSM.DLL (x64)
You can compile your application with version 7.0 of VintaSoftTwain.NET SDK in "x86" (WOW) mode
and your application will:
  • work in x32 systems with TWAIN_32.DLL or TWAINDSM.DLL (x32)
  • work in x64 systems with TWAIN_32.DLL or TWAINDSM.DLL (x32)
You can compile your application with version 7.0 of VintaSoftTwain.NET SDK in "x64" mode and
your application will:
  • NOT work in x32 systems
  • work in x64 systems with TWAINDSM.DLL (x64)
We recommend use "x86" mode because all scanners have x32 TWAIN drivers but only new and
professional scanners have native x64 TWAIN drivers.

Best regards, Alexander
pwsmietan
Posts: 7
Joined: Wed Aug 26, 2009 12:46 am

Re: Use 32-bit or 64-bit DLL depending on platform

Post by pwsmietan »

Alex,

I like the idea of compiling using the "Any CPU" configuration. Q: How do we reference in our project the right assemblies? I'm a little lost here - since Vintasoft TWAIN x86 and x64 are two seprate DLL's which would we reference for our development and how would we deploy in our setup?

thanks!

-Paul
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Use 32-bit or 64-bit DLL depending on platform

Post by Alex »

Hello Paul,

You can use Vintasoft.Twain.dll from x86 or x64 directories - it's the same DLL.

Best regards, Alexander
sankar Joseph
Posts: 1
Joined: Tue Feb 22, 2011 11:12 pm

Re: Use 32-bit or 64-bit DLL depending on platform

Post by sankar Joseph »

I have an Issue with the Any CPU build. I have added the Vintasoft Twain x86 dll, If I build the app in x86 mode then it is showing the devices list but If I try with Any CPU mode it is not showing, Is there anyother settings i need to change for this? What is the DSM dlls?
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Use 32-bit or 64-bit DLL depending on platform

Post by Alex »

Hello,

I think you have 64-bit system and 64-bit systems are supported only since TWAIN 2.0 - you need to install TWAIN 2.0 Data Source Manager (DSM) in the system.

Best regards, Alexander
Post Reply