02-05-2013 09:54 AM
I'm currently trying to run a vbai program with .net like in the DotNET examples included in the "API Examples" map. I added the NationalInstruments.VBAI.2008 to my References in visual studio 2008 and the program runs fine on my Windows XP SP3 32bit system. When I run the program on a Windows 7 32bit machine it also runs but when I test it on a Windows 7 64bit the program crashes as soon as I try to run this line of code:
VBAIEngine engine =newVBAIEngine("Engine"string.Empty, false);
I get the error:
System.DllNotFoundException: Can't load DLL VBAIInterfaceC.dll.
Is this is a 64 bit problem cause when I look up the dll file I find it on 32bit machines in the folder C:\Windows\System32 and in the 64bit machine it is in the C:\Windows\SysWOW64 folder.
Do I use the wrong DLL files or is there something else I should consider using 64bit?
Thank you in advance for any help.
Solved! Go to Solution.
02-05-2013 10:27 AM
You must configure your 64-bit MSVC project to run in 32-bit mode so it will find the 32-bit dll in the 32-bit Windows\SysWOW64 directory. You should be able to go to Build>>Configuration Manager... and set the Platform to x86. The directions may be slightly different for different versions of MSVC, so these are the directions for MSVC 2010. I found this here:
Hope this helps,
Brad
02-05-2013 11:12 AM
Just to add some clarification -
By default .NET applications are built as "AnyCPU" which means that the runtime compiles it on-the-fly for 32 or 64-bit mode depending on the host OS whenever it is run (from the single binary). This is in contrast to a typical compiled C/C++/LabVIEW application where the bitness is fixed.
As Brad mentioned, right now the VBAI API DLLs are only released as 32-bit binaries, so you need to ensure your application using them always runs in 32-bit mode. This is simply a compile option that sets a flag in the resulting binary.
Eric