
Lab::VISA::Installation - Installation guide for Lab::VISA

Lab::VISA has been tested to work on Linux and Windows, both with ActiveState Perl and the Microsoft VC++ Compiler, and Strawberry Perl with the included gcc compiler.

From now on run all commandline programs during installation only from the "Visual Studio Command line", which can be found in the Start menu.
pgnuplot.exe to path: My Computer => Properties => Advanced => Environment VariablesMakefile.PL adapt the LIBS and INC settings according to your installation (the location looked up above).
This is what worked for me:
'LIBS' => ['-"lC:\\Programme\\IVI Foundation\\VISA\\WinNT\\lib\\msc\\visa32.lib"']
'INC' => '"-IC:\\Programme\\IVI Foundation\\VISA\\WinNT\\include"'
You can find the LIBS folder by checking the registry key "InstDir" in folder "HKEY_LOCAL_MACHINE\SOFTWARE\National Instruments\NI-VISA for Windows 95/NT".
perl Makefile.PL
nmake
nmake install

Strawberry Perl is a Perl distribution for Windows that most closely mimics a Perl installation under Linux. It comes with gcc compiler, dmake and the other relevant tools included.
Lab::VISA should in principle install out of the box with just the command
cpan Lab::VISA
executed on the commandline. Unfortunately there is a bug in ExtUtils::MakeMaker (see here) that prevents this. Two possible workarounds are explained below.
visa462full.exe from NI's websitevisa32.lib and visa.h and adjust Makefile.PL. This is what worked for me:
'LIBS' => q("-lC:/Programme/IVI Foundation/VISA/WinNT/lib/msc/visa32.lib"),
'INC' => q("-IC:/Programme/IVI Foundation/VISA/WinNT/include"),
Kid.pm of your installation of ExtUtils::MakeMakerperl Makefile.PLIf you don't like to modify the installed version of ExtUtils::MakeMaker, you can edit the generated Makefile. These changes will be lost after executing perl Makefile.PL again though. This option is recommended if you just want to install Lab::VISA.
perl Makefile.PLMakefile:
Find the two lines containing the words EXTRALIBS and LDLOADLIBS. Add the "C:\path\to\visa32.lib" to each of of these lines. On my system they read:
EXTRALIBS = "C:\Programme\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib" C:\strawberry\c\lib\libmoldname.a ... LDLOADLIBS = "C:\Programme\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib" C:\strawberry\c\lib\libmoldname.a ...
dmakedmake install
As a Linux user you will probably be able to figure out things yourself. Here is a rough outline:
Makefile.PL adapt the LIBS and INC settings according to your installation. This is what worked for me:
'LIBS' => ['-lvisa'],
'INC' => '-I/usr/local/vxipnp/linux/include/',
perl Makefile.PL
make
make install

Here is a quick test program that you can run with perl -Mblib test.pl:
#!/usr/bin/perl
use Lab::VISA;
my ($status, $sesn) = Lab::VISA::viOpenDefaultRM();
printf "status: %x (%s)\n", $status, (($status == $Lab::VISA::VI_SUCCESS) ? "success" : "no success");
print "sesn: $sesn\n";
my ($status, $findList, $retcnt, $instrDesc) = Lab::VISA::viFindRsrc($sesn, "ASRL1::INSTR");
printf "status: %x (%s)\n", $status, (($status == $Lab::VISA::VI_SUCCESS) ? "success" : "no success");
print "findList: $findList\n";
print "retcnt: $retcnt\n";
print "instrDesc: $instrDesc\n";
__END__

(c) 2010,2011 Daniel Schröer, Andreas K. Hüttel, Daniela Taubert, and others. 2012 Andreas K. Hüttel