08-01-2012 01:41 PM - edited 08-01-2012 01:49 PM
Hi folks, I have a project in VB. NET (VS2010 specifically), which was upgraded from an old VB6 project. The old project
used Niglobal.bas and Vbib-32.bas to communicate with the GPIB plugged into one of our scopes.
Now in the 64 bit Win7, with the Niglobal.bas and Vbib-32.bas converted to Niglobal.vb and Vbib-32.vb,
I get an error during debugging at
Public Sub RegisterGPIBGlobals()
in the Vbib-32.vb, the error msg says:
Unable to load DLL 'Gpib-32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
It looks like this Gpib-32.dll, which I find under SysWOW64 on my Win7, isn't designed for 64bit application, and when I copy this dll file over to
C:\Windows\System32, the error msg becomes:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
So I think my question is two fold: 1. When writing my own application in VB.NET can I still uses Gpib-32.dll (by including Niglobal.vb and Vbib-32.vb )?
2. Will the application I write with .NET work in x64 Windows 7?
Almighty Gurus and Mods please help. Thanks!
Solved! Go to Solution.
08-01-2012
02:27 PM
- last edited on
02-05-2025
04:31 PM
by
Content Cleaner
https://www.ni.com/en/support/documentation/supplemental/17/archived--c--and-visual-basic--net-instr... may be useful
http://digital.ni.com/public.nsf/allkb/9D74098B0AFB1D2286256EF40063B3E2
http://digital.ni.com/public.nsf/allkb/4043FBAE3E3CBD3386256D9600538319
08-01-2012
03:42 PM
- last edited on
02-05-2025
04:32 PM
by
Content Cleaner
thx for replying. but the suggestions from the links (Native .NET GPIB Language Interface) are targeting .NET 1.0 and VS 2005. I'm on .NET 4 and VS2010.
----------------
I did find some more on this topic.
Someone else also using VB.NET and Windows 7 got this in the reply :
And it seems like I would need to "Switch to the ni4882.dll" if I were to use GPIB in Visual Studio 2010.(Am I right here?)
Has anyone ever made such changes(from what I understand, change the program from using Niglobal.vb and Vbib-32.vb which leads to gpib-32.dll, to using something that leads to ni42882.dll )?
I see in the NI-488.2 User manual there's this section "Differences Between the GPIB32 API and NI4882 API" but it's assuming I'm using a header called ni488.h and linked to the object gpib-32.obj, which I'm not.
I guess simply put, my question is: how do one use new NI4882 API , which uses ni42882.dll?
08-06-2012
12:45 PM
- last edited on
02-05-2025
04:32 PM
by
Content Cleaner
Hello SandiegoSD,
The first thing that I would like to check is that you have the latest version of the NI 488.2 drivers which are available here:
https://www.ni.com/en/support/downloads/drivers/download.ni-488-2.html
I will continue looking into this error, and please let me know if there are any additional updates or questions regarding this issue.
Thanks,
Joel
08-06-2012 02:10 PM
Hey Joel, Thanks for the response! I do have the 3.0.2 driver.
I was searching around for quite a while after I posted here and later in the NI4882 user manual , page 4-4, I found this:
"To port an application to a 64-bit environment requires that the application migrate to the NI4882 API and be recompiled."
So I'm ditching the gpib-32.dll(vbib-32&niglobal) and currently I'm using NI4882.dll and restructuring my project.
12-23-2015 10:48 AM
I am struggling with the same issue, and would prefer not to recode the calls.
One thing that is perplexing is that I can run older VB6 apps that use the gpib-32.dll calls on Windows7 - 64bit with no problem, but if I try to run an app that was written in VB.net using the same calls, it fails on Windows7
In all cases the apps work fine of WindowsXP
So why does VB6/gpib-32.dll work on WIndows7-64bit?
Why does VB.net/gpib.32.dll fail on WIndows7-64bit?
The environment and the compatibility mode is the same on the executables.
The source code as actually ported from VB6 to VB.net is is very very similar.
The VB.net program returns a GPIB not found error.
Here is a typical declaration in VB.net that compiles but does not seem to work, but that works fine in VB6
Declare Function ibask32 Lib "gpib-32.dll" Alias "ibask" (ByVal ud As Integer, ByVal opt As Integer, ByRef value As Integer) As Integer
12-28-2015 01:56 PM
VB6 is a 32-bit system used to develop 32-bit applications and therefore, can use the gpib-32.dll. Whereas when working on a 64-bit OS, vb.NET will, by default, create 64-bit applications which cannot use the gpib-32.dll. The 32-bit application built by VB6 can run on 64-bit operating systems so therefore I believe this is why one works and the other doesn’t.
At the forum below D_Biel explains this and states the three options you have.
“The gpib-32.dll is a 32-bit only DLL (hence the title). So you cannot build a 64-bit application using it. In .NET you have the option of choosing Any CPU which, like you said, determines it's bitness at runtime. This should allow your program to work on a 32-bit system, but not a 64-bit system (assuming it lets you compile, I'm not sure if Visual Studio will notice you are using a 32-bit library). So instead you have a few options:
Hope this helps.
12-30-2015 08:59 PM
Have you found your solution. I am having this same problem as you also.
01-04-2016 08:44 AM
In this particular case, GPIB-32.dll was being used to create 64 bit applications and this is not possible. You would have to switch to NI4882.dll if you are developing a 64-bit application.
01-04-2016 01:49 PM
Ok, I will try to recompile as an x86 app to force 32-bit compatibility.
Will post results once I get a chance.
Thanks for the options.