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.

TekScope IVI-C Driver Crashes

Post Reply
tomkiti
Posts: 2
Joined: June 28th, 2018, 6:42 am
Country: United States

TekScope IVI-C Driver Crashes

Post by tomkiti » June 28th, 2018, 10:49 am

Hello,

I'm having trouble calling certain functions in the TekScope IVI-C driver (IVIDriver3.9_066045315_0). I can successfully call all of the the base IviScope class functions (e.g. TekScope_Abort) and get/set base attributes (e.g. TEKSCOPE_ATTR_INSTRUMENT_MODEL). However, whenever I call one of the instrument-specific functions (e.g. TekScope_ClearAll) or get/set an attribute (e.g. TEKSCOPE_ATTR_ACCEPT_COUNT), I get a program exception trying to access a null pointer. This happens when controlling a real device or using simulation mode.

What's interesting is that if I use the wrong get/set attribute function for the attribute type, the correct error code is returned. For example, if I call TekScope_GetAttributeViInt32 to get TEKSCOPE_ATTR_ACCEPT_TIMEOUT (a ViReal64), it correctly returns 0xbffa0015 (IVIC_ERROR_TYPES_DO_NOT_MATCH), so there is some error checking happening before the crash.

Here a test program that demonstrates the problem and throws an exception within TekScope_GetAttributeViInt32:

Code: Select all

#include "stdafx.h"
#include <stdio.h>
#include "TekScope.h"

int main()
{
    ViStatus status;
    char resource[] = "MyResource";
    ViBoolean idQuery = VI_FALSE;
    ViBoolean reset = VI_TRUE;
    char options[] = "Simulate=true";
    ViSession session;
    ViInt32 ErrorCode;
    ViChar ErrorMessage[256];

    status = TekScope_InitWithOptions(resource, idQuery, reset, options, &session);
    if (status)
    {
        // Initialization failed
        TekScope_GetError(session, &ErrorCode, 255, ErrorMessage);
        printf("InitWithOptions() Error: %d, %s\n", ErrorCode, ErrorMessage);
        return ErrorCode;
    }
    printf ("session = %d\n", session);

    ViInt32 value;
    status = TekScope_GetAttributeViInt32(session, VI_NULL, TEKSCOPE_ATTR_ACCEPT_COUNT, &value);
    if (status)
    {
        // GetAttribute failed
        TekScope_GetError(session, &ErrorCode, 255, ErrorMessage);
        printf("TekScope_GetAttributeViInt32() Error: %d, %s\n", ErrorCode, ErrorMessage);
        return ErrorCode;
    }

    printf("TEKSCOPE_ATTR_ACCEPT_COUNT = %d\n", value);
    return 0;
}

What am I doing wrong?

Thanks,
Tim

tomkiti
Posts: 2
Joined: June 28th, 2018, 6:42 am
Country: United States

Re: TekScope IVI-C Driver Crashes

Post by tomkiti » January 8th, 2019, 4:26 am

Is anyone else having trouble with the TekScope driver? I wrote to Tektronix tech support but never received a reply. Is the IVI technology obsolete?

Post Reply

Return to “IVI Drivers”

Who is online

Users browsing this forum: No registered users and 1 guest