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.

TekVISA C++ 32bits (x86) or 64 bits (x64)?

OpenChoice TekVISA
Post Reply
Posts: 2
Joined: April 2nd, 2018, 2:51 am
Country: Denmark

TekVISA C++ 32bits (x86) or 64 bits (x64)?

Post by JSandberg » April 3rd, 2018, 9:37 am

I have installed TekVISA and I am using Visual Studio 2017 C++. Shall I make the program for a x86 or x64 machine? Currently, the linker issues a number of error messages stating there is a mismatch between x86 and x64 pieces in header files and libraries.

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 and Visual Studio Express 2017 C++. Do you have such an update?

Dave W
Tektronix Applications
Tektronix Applications
Posts: 308
Joined: April 26th, 2010, 12:01 pm
Country: United States

Re: TekVISA C++ 32bits (x86) or 64 bits (x64)?

Post by Dave W » April 10th, 2018, 12:22 pm

Hi JSandberg,

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!

(721.33 KiB) Downloaded 928 times

Posts: 2
Joined: October 19th, 2018, 6:52 pm
Country: United States

Re: TekVISA C++ 32bits (x86) or 64 bits (x64)?

Post by fabienteulieres » October 19th, 2018, 8:04 pm

Hi JSanberg and Dave W,

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;
As commented above, the call to viOpen would systematically fail in x64 with the error: "The given session or object reference is invalid"

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!

Post Reply

Return to “TekVISA”

Who is online

Users browsing this forum: No registered users and 1 guest