Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Share GPIB handles across application

I am building a Multi-Up test system where several applications will have to make GPIB calls at the same time. I am trying to provide sychronization mechanisms to protect data and logic. I was wondering if the GPIB handle could be held in a shared segment and passed on to another application for use.

1) App A,B,C loads a shared dll
2) App A open GPIB(0,1) and the handle is held in a shared segment in the dll
3) App B opens GPIB(0,1) through shareddllAPI. Shared dll gives AppB the same handle opened by App A

will this work? I want to avoid client server model and IPC because of the heavy use of GPIB communication. Also i want to avoid the cost of opening and closing the port for each read/write/query.

Will i face problems if i try to keep the GPIB handle in a shared data segment? If not, is there a way to avoid the client server model and aviod the cost of context switch for each gpib opeartion?
0 Kudos
Message 1 of 2
(2,644 Views)
In short, no. See the NI-488.2 help file (should be on your start menu) under the topic IBFIND:

"Note: Unit descriptors are allocated on a per process basis, so it is not possible to share them between processes. If you pass a unit descriptor from one process to a second process, all NI-488.2 calls using that descriptor in the second process will return EDVR."

You might consider using multiple threads in a single process to accomplish something similar.

Scott B.
GPIB
National Instruments
0 Kudos
Message 2 of 2
(2,626 Views)