Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make the call to VISA dynamic for application on a Computer which may have or may have not VISA driver installed?

I am using a NI AT GPIB/TNT card for accessing devices with GPIB Interface.
So far it runs well.
I am using the VISA library to communicate.
But my software has to run also on machines which do not have the interface installed.
So at runtime I have to find out if the driver is installed and then do the communication or not.
Is there a sample to load the VISA32.dll dynamically?
I am Using Visual C++ 6.0
The NI-488.2 CD-ROM I have is dated July 2000.
0 Kudos
Message 1 of 3
(3,554 Views)
To load VISA32.DLL dynamically, you can use the Win32 functions LoadLibrary() and FreeLibrary(). But this approach requires your app to call GetProcAddress() for every VISA function your app invokes. A simpler approach of this is use the "deley loading" feature of VC++. This requires linker settings a bit, but you only need to call the functions as if the DLL is statically imported. But in fact the DLL is dynamically imported. The app, with this approach, does work without VISA32.DLL.

To check the existence of VISA32.DLL, just call LoadLibrary() and see its return value. Mind that calling a VISA function without VISA32.DLL makes your app crashed.

Hope this helps,
Makoto Kondo, Kikusui Electronics Corp.
0 Kudos
Message 2 of 3
(3,554 Views)
Thanks for the answer. I think the delay loading feature could be helpful. But now I already did the LoadLibrary way with GetProcAddress() for all the functions I needed. I think this is the more saver way to get it handled, because then I am sure, that all functions I need are really supported (I can check the function pointers returned by GetProcAddress)
Martin Blank
0 Kudos
Message 3 of 3
(3,554 Views)