Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a GPIB-32.LIB file?

Hi,

I was looking into what was involved in programming
a NI GPIB card using the Win32 API and noticed that
the User Manual provided a
LoadLibrary()/GetProcAddress() approach to directly
accessing functions in GPIB-32.DLL. While there are
often good reasons for doing this, usually it is
easier to just link with a .LIB file for the DLL.
But I did not see this mentioned in the manual, and
after installing the Visual C++ development portion
of the setup, there was no GPIB-32.LIB file created
anywhere. Is there a reason why
LoadLibrary()/GetProcAddress() is preferred for
this DLL? Thanks for any information.

Jim Monte
0 Kudos
Message 1 of 3
(4,368 Views)
Jim,

We actually include a gpib-32.obj file. The code in the .OBJ file calls LoadLibrary() and GetProcAddress() for you, such that you will have the same functionality as linking against a .lib file but will be protected in the case that gpib-32.dll is not on the system. The gpib-32.obj file is located in ..(Install root)/National Instruments/NI-488.2/Languages/Microsoft C/. You may link against this file so that you do not have to use the LoadLibrary() functionality yourself.

Craig A.
National Instruments Engineer
0 Kudos
Message 2 of 3
(4,368 Views)

**CAVEAT**

If you use the .obj mentioned above and GPIB-32.DLL isn't found, your app will die silently, just like if you static-linked to an import lib.

So if there's any possiblity that GPIB-32.DLL won't be on the system or won't be findable, you gotta use LoadLibrary() so you can die gracefully.

0 Kudos
Message 3 of 3
(3,236 Views)