Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.
I would highly appreciate an update of chapter "Compiling and Linking Examples" on pages 5-2 and 5-3 of the TekVISA Programmer manual valid for TekVISA version 188.8.131.52 and Visual Studio Express 2017 C++. Do you have such an update?
You can use TekVISA to build either x86 or x64 applications using Visual Studio 2017 C++. The key is making sure you have configured your project properties with the correct include directories and Linker Library directories.
TekVISA includes many examples that can be found by going to your Start menu -> TekVISA -> VisaSamples. Unfortunately these examples were written a while back using Visual Studio 2008 so to get them to run now using Visual Studio 2017 and the latest versions of Windows and VISA the projects themselves need to be updated a little to get them running. This just involves updating the project properties as I mentioned earlier. No changes to the code are needed.
To assist you with getting started with TekVISA and Visual Studio 2017 I have updated the example titled "simple" to work in VS2017 and attached it to this post. I have updated the paths in the project properties so it will compile for both x86 and x64.
Hope this helps you out!
I've experienced similar problems when using the TekVISA libraries in C++ with Visual Studio 2017 in x86 and x64: my C++ code would run as expected when built in x86, but I would have lots of issues when running it in x64. That blocked my progress for a long time.
If this may help anyone - and save them hours of research, here was my issue (and the solution):
Code: Select all
ViSession rm = VI_NULL, vi = VI_NULL; ViStatus status; // Open a default Session status = viOpenDefaultRM(&rm); if (status < VI_SUCCESS) goto error; // Open the USB device status = viOpen(rm, (ViRsrc)"USB::<My Scope ID>::INSTR", VI_NULL, VI_NULL, &vi); // This line would systematically fail in x64: "The given session or object reference is invalid" if (status < VI_SUCCESS) goto error;
After using the "simple.zip" project provided above, I found out that this one worked fine as promised. That was a relief, but now I had to track down what Visual Studio option was causing a problem between that "simple" solution and mine!
And I found out it is the following one:
VS C++ Project options \ Linker \ Advanced \ Randomized Base Address
That value must be set to "No (/DYNAMICBASE:NO)" for the call to viOpen to work on my project in x64.
Now that may be a machine-dependent issue, I don't know. But I think it's worth posting it here!
Who is online
Users browsing this forum: No registered users and 1 guest