05-07-2020 05:36 PM
The parameters ... are well defined in this manual, but are "viOpen" or "viOpenDefaultPM" the strings I should be sending the dll to access these functions?
It seems to be a sort of syntax shortcut in LB, stricly speaking you only send parameters to the dll when calling a function, but you don't "send" the function name, just call the function. If I understand the syntax
calldll #lj, "GetFirmwareVersion", gv as struct, reply as double
means calling the function GetFirmwareVersion passing the following variables as parameters. Still I don't see where the type of the function return is specified (this one is void I suppose?), you will have to study it because all Visa functions return a result code (you can't just "ignore" the result in the declaration, any mistake in a type specification will result in stack unbalance and possibly a crash of your app).
Anyway it is easy to understand the VB syntax given in the manual (easier than the C syntax which is using some NI-specific type definitions probably hidden somewhere in remote NI header files), for example in :
viOpen&(ByVal sesn&, ByVal rsrcName$, ByVal accessMode&, ByVal openTimeout&, vi&)
& and % are implicit type indicators: & for Int32 and $ for string,
therefore viOpen& is a function returning an Int32, the first parameter sesn& is an Int32, rsrcName$ a string etc.
Byval means passing parameter "by value", as far as I remember if it is not there it means that the parameter is passed "by address" by default (i.e. passing a pointer to the variable).
You will need to find the equivalent syntax in LB for all these cases, i.e. how to specify the return values and how to select value/address mode. For strings you will need to search how to pass "null-terminated" strings (LPSTR type in C). Once you have all this information everything will become trivial.
05-08-2020 06:08 AM
Hello,
You will find all the information here
http://www.libertybasicuniversity.com/lb4help/12B_ZGL.htm
http://www.libertybasicuniversity.com/lb4help/5HHS.Y8.htm
05-08-2020 08:03 AM
Did you look at the visa32.bas file in this folder: C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Include
Should help work out which data types to use