Exception Triggered(read access violation) if QSerialPort instance is created with VECTOR dll(vxlapi.dll)

  • Hello,

    I have struggled with exception problem during few weeks. :(
    Please give me some tips for this~

    I'm trying to a program that receive GPS data by serial port, and send CAN message using the data.
    Development environment is,

    • IDE : Qt Creator 3.1.2(based on Qt 5.3.1)
    • Qt version : Qt5.3 MSVC2013 32bit
    • Compiler : Microsoft Visual C++ compiler 12.0(x86)
    • Device type : Desktop(Local PC)

    And for device,

    • GPS device : ASCEN GPS (GPS742)
      a. This is connected with PC by USB cable.
      b. PC recognize it by serial port(COM12, Baud115200, 8 bit, No parity, one stop bit, No flowControl).
      c. It send GPS data periodically(about 1 second.)
    • CAN device : VECTOR CAN/LIN Interface (VN1630)
      a. This is connected with PC by USB cable.
      b. It can control by dll files('vxlapi.h', 'vxlapi.dll', and 'vxlapi.lib')

    At first, I made two individual programs,

    • 'Receiving & show GPS data' : using 'QSerialPort' class. It works well.
    • 'Sending dummy CAN message' : using dll files. It works well.

    But when I merged these programs, It compiled well but generated exception error.(read access violation)

    For Debug, I made simple console project like below,

    QT += core
    QT += serialport
    QT -= gui

    TARGET = SerialPortControlExample_ref
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp


    HEADERS +=

    win32: LIBS += -L$$PWD/ -lvxlapi


    #include <QtCore/QCoreApplication>
    #include <QtCore/QDebug>
    #include <QtSerialPort/QSerialPort>
    #include <QtSerialPort/QSerialPortInfo>
    #include <windows.h>
    #include "vxlapi.h"


    int main(int argc, char *argv[])
    XLstatus xlStatus;
    QCoreApplication a(argc, argv);

    //------------ 1st Section --------------------------------------------------
    xlStatus = xlOpenDriver();
    if(xlStatus == XL_SUCCESS) qDebug() << "Open Success!!";
    else qDebug() << "Open Fail!!!";
    //------------- End of 1st Section-------------------------------------------

    //------------ 2nd Section --------------------------------------------------
    // Example use QSerialPortInfo
    foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
    qDebug() << "Name : " << info.portName();
    qDebug() << "Description : " << info.description();
    qDebug() << "Manufacturer: " << info.manufacturer();

        // Example use QSerialPort
        QSerialPort serial;
        if (serial.open(QIODevice::ReadWrite))

    //------------- End of 2nd Section-------------------------------------------

    return a.exec&#40;&#41;;


    [vxlapi.h, vxlapi.lib, vxlapi.dll]

    Among above 'main.cpp' file, if one of section is commented out, it is compiled and running correctly.

    A. If 1st section is commented out...
    [Commannd Window]
    Name : "COM12"
    Description : "GPS USB Serial Interface Driver"
    Manufacturer: "Media Tek Inc."

    B. If 2nd section is commented out,
    [Commannd Window]
    Open Success!!

    But when I use both section, it is compiled well but generated exception message once I run this program, like below,
    [Exception Triggered Window]
    The inferior stopped because it triggered an exception.
    Stopped in thread 0 by: Exception at 0x77a1e066, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance).

    The debugging result is below,
    dState changed from EngineRunRequested(7) to InferiorRunOk(11) [master]
    ModLoad: 75570000 755d0000 C:\WINDOWS\SysWOW64\IMM32.DLL
    ModLoad: 76df0000 76ebc000 C:\WINDOWS\syswow64\MSCTF.dll
    (2d4.2558): Access violation - code c0000005 (first chance)

    sException at 0x77a1e066, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance) in ntdll!RtlAllocateHeap
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    eax=77280334 ebx=00000000 ecx=00000010 edx=003bf1ec esi=00000000 edi=000000e0
    eip=77a1e066 esp=003bee50 ebp=003beebc iopl=0 nv up ei ng nz ac pe cy
    cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010297
    77a1e066 8b4344 mov eax,dword ptr [ebx+44h] ds:002b:00000044=????????

    *** WARNING: Unable to verify checksum for C:\JayKim\EnS\JaySW\SerialPortControlExample_ref\vxlapi.dll
    *** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\JayKim\EnS\JaySW\SerialPortControlExample_ref\vxlapi.dll -
    sException at 0x77a1e066, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance)
    dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
    Resolving symbol: ntdll!RtlAllocateHeap...
    <x ntdll!RtlAllocateHeap

    Obtained 0x77a1e046 for ntdll!RtlAllocateHeap (#1)
    <u 0x77a1e046 0x77a1e168

    Please let me know some tips for these issues.

    Thank you.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.