Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

No Global Status Variables exported in ni4882.dll ?

Hi,
as far as I understand the Manual to NI-488.2 version 3.11 and the corresponding ni4882.h file, there should be global status variables exported for DLL direct entry (ibsta, iberr, ibcnt/ibcntl). When I inspect ni4882.dll (using DLL Export Viewer) these variables don't show up (I also cannot access them from my application).
 
I am in the process of porting my application from 32-bit using gpib-32.dll to 64-bit using ni4882.dll. Because my application should be platform independed, I would like to avoid changing the code to use the global status functions that report the status (Ibsta, Iberr, Ibcntl) - the NI Mac-framework only supplies the global status variables and no functions.
 
Any ideas how I could access the global status variables or do I need to change the code to use global status functions?
 
Thanks,
Kurt

0 Kudos
Message 1 of 5
(3,830 Views)

Hey Kurt,

 

I found a KnowledgeBase article on the matter and it says that new code should use these functions instead of the ibstaiberr, etc. Here is the article for reference:

 

http://digital.ni.com/public.nsf/allkb/85C6F4990C8BA691862575FB006F1EDB?OpenDocument

 

And this is the line from the article:

 

"Global status functions have been added. These are Ibsta()Iberr(), and Ibcnt(). New code should use these functions instead of ibstaiberr, or ibcnt/ibcntl.."

 

Regards,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 2 of 5
(3,804 Views)

Hi,

 

thanks for the link. It is correct that global status function have been added, but the manual (cf attached file) says

 

on page 4-2 "The dynamic link libraries export pointers to each of the global status functions or variables and all the NI-488.2 calls."

 

and on page 4-4 "Modifying existing applications to use the NI4882 API should require minimal changes. In most cases, using the new include file (ni4882.h instead of ni488.h) and linking to the new object file (ni4882.obj instead of gpib-32.obj) is sufficient to compile your application."

 

and it seems that this is not true for NI4882.dll version 3.11.

 

I could change my application to use the status reporting functions rather than the global variables. My application is written in Java and it also works om MAC and possible Linux, and on these platforms there are afaik only global status variables defined. So my code now uses two different ways of determining the status. Not especially nice, but it works.

 

Nevertheless I suggest to either export the global status variables as promised in the manual and the ni4882.h file, or change the manual to highlight this (important) point as a difference between using gpib-32.dll and ni4882.dll.

 

Thanks and best regards,

Kurt

0 Kudos
Message 3 of 5
(3,795 Views)

Hi Kurt,

 

You are absolutely right about the variables not being exported from the DLL. There are global variables available, but they are actually implemented in the language interface object file. For most users they continue to work, because this is how most users utilize NI-488.2.

 

In your case you will need to utilize the status functions. One option that you have is to consider whether you application could make use of thread status instead of global status functions. ThreadIbsta, ThreadErr, and ThreadIbcnt exist in both APIs. They are preferred over the global status, because they avoid possible corruption if you are making GPIB calls simultaneously from more than one thread. Whether you will be able to use them will depend on how your application utilizes threading.

 

Please let me know if this is a viable alternative for you,

 

Jason Smith

Message 4 of 5
(3,785 Views)

Hi Jason,

 

thanks for clarifying why there are no global variables exported in the DLL. I changed the program to use the status functions, and it seems to work fine.

Thanks a lot,

Kurt

0 Kudos
Message 5 of 5
(3,734 Views)