Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Debugger detects exception: Exception at 0x0, [...]: write access violation

Debugger detects exception: Exception at 0x0, [...]: write access violation

Scheduled Pinned Locked Moved Solved General and Desktop
debbugerexceptionwrite accessviolation
5 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tim5
    wrote on 6 Apr 2021, 18:02 last edited by
    #1

    Hello,

    I am quite new to qt and I am wondering if someone could help me with my problem.

    I am developing a project for a company as a student project. The company send me only an .dll file and a documentation about the contained functions I want to/should use.

    Since I only have the .dll I used "QLibrary" and "resolve" to load the functions into my qt project.

    I only loaded them where I use them, in the mainwindow.cpp.

    This is how I accomplished it:

    these are in my opinion the relevant snippets:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <string>
    #include <QFile>
    #include <iostream>
    
    #include <QLibrary>
    QLibrary myLib("GP_MUX_MODAWIFI.dll");
    typedef bool (*pointer3)();
    pointer3 MUX_Open = (pointer3) myLib.resolve("MUX_OPEN");
    
    /*...*/
    
    void MainWindow::CmdOpenClicked()
    {
    
        bool openOK = MUX_Open();
        if(openOK)
        {
            ui->LblOpen->setText("Start");
        }
        else
        {
            ui->LblOpen->setText("Error");
        }
    
    }
    
    /*...*/
    

    I do not know about what the function is exactly doing but the function should start a data transmission with a wifi transmitter module.

    I am receiving this error when I click CmdOpen in my application.

    Debugger detects exception: Exception at 0x0, code: 0xc0000005: write access violation at: 0x0, flags=0x0 (first chance)

    Do you have a clue what I could do to fix the problem without knowing about detailed information about the function I am calling. Or do you have an idea why this error occurs?

    I tried to find the solution over a few hours but did not succeed.

    Thanks in advance.
    Tim

    J 1 Reply Last reply 6 Apr 2021, 18:11
    0
    • T tim5
      6 Apr 2021, 18:02

      Hello,

      I am quite new to qt and I am wondering if someone could help me with my problem.

      I am developing a project for a company as a student project. The company send me only an .dll file and a documentation about the contained functions I want to/should use.

      Since I only have the .dll I used "QLibrary" and "resolve" to load the functions into my qt project.

      I only loaded them where I use them, in the mainwindow.cpp.

      This is how I accomplished it:

      these are in my opinion the relevant snippets:

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include <string>
      #include <QFile>
      #include <iostream>
      
      #include <QLibrary>
      QLibrary myLib("GP_MUX_MODAWIFI.dll");
      typedef bool (*pointer3)();
      pointer3 MUX_Open = (pointer3) myLib.resolve("MUX_OPEN");
      
      /*...*/
      
      void MainWindow::CmdOpenClicked()
      {
      
          bool openOK = MUX_Open();
          if(openOK)
          {
              ui->LblOpen->setText("Start");
          }
          else
          {
              ui->LblOpen->setText("Error");
          }
      
      }
      
      /*...*/
      

      I do not know about what the function is exactly doing but the function should start a data transmission with a wifi transmitter module.

      I am receiving this error when I click CmdOpen in my application.

      Debugger detects exception: Exception at 0x0, code: 0xc0000005: write access violation at: 0x0, flags=0x0 (first chance)

      Do you have a clue what I could do to fix the problem without knowing about detailed information about the function I am calling. Or do you have an idea why this error occurs?

      I tried to find the solution over a few hours but did not succeed.

      Thanks in advance.
      Tim

      J Online
      J Online
      JonB
      wrote on 6 Apr 2021, 18:11 last edited by JonB 4 Jun 2021, 18:11
      #2

      @tim5 said in Debugger detects exception: Exception at 0x0, [...]: write access violation:

      pointer3 MUX_Open = (pointer3) myLib.resolve("MUX_OPEN");

      I imagine this has returned nullptr, as it cannot load the library/resolve the function.

      bool openOK = MUX_Open();

      Since I imagine MUX_Open is nullptr, hence the exception you get.

      T 1 Reply Last reply 6 Apr 2021, 18:15
      3
      • J JonB
        6 Apr 2021, 18:11

        @tim5 said in Debugger detects exception: Exception at 0x0, [...]: write access violation:

        pointer3 MUX_Open = (pointer3) myLib.resolve("MUX_OPEN");

        I imagine this has returned nullptr, as it cannot load the library/resolve the function.

        bool openOK = MUX_Open();

        Since I imagine MUX_Open is nullptr, hence the exception you get.

        T Offline
        T Offline
        tim5
        wrote on 6 Apr 2021, 18:15 last edited by
        #3
        This post is deleted!
        J 1 Reply Last reply 6 Apr 2021, 18:20
        0
        • T tim5
          6 Apr 2021, 18:15

          This post is deleted!

          J Online
          J Online
          JonB
          wrote on 6 Apr 2021, 18:20 last edited by JonB 4 Jun 2021, 18:21
          #4

          @tim5
          No, as I don't know what your document/third-party product tells you to do, or even works.

          The company send me only an .dll file and a documentation about the contained functions I want to/should use.

          Sounds a bit lean!

          But I'd start from QString QLibrary::errorString() const

          Returns a text string with the description of the last error that occurred. Currently, errorString will only be set if load(), unload() or resolve() for some reason fails.

          Is the path to the .DLL right? Is that really an exported function?

          T 1 Reply Last reply 6 Apr 2021, 19:03
          0
          • J JonB
            6 Apr 2021, 18:20

            @tim5
            No, as I don't know what your document/third-party product tells you to do, or even works.

            The company send me only an .dll file and a documentation about the contained functions I want to/should use.

            Sounds a bit lean!

            But I'd start from QString QLibrary::errorString() const

            Returns a text string with the description of the last error that occurred. Currently, errorString will only be set if load(), unload() or resolve() for some reason fails.

            Is the path to the .DLL right? Is that really an exported function?

            T Offline
            T Offline
            tim5
            wrote on 6 Apr 2021, 19:03 last edited by tim5 4 Jun 2021, 19:11
            #5

            @JonB yes the path to the .dll ist right - the weird thing is that one function works fine but the others won't

            The error I am receiving is: Unkown error.

            1 Reply Last reply
            0

            5/5

            6 Apr 2021, 19:03

            • Login

            • Login or register to search.
            5 out of 5
            • First post
              5/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved