Debugger detects exception: Exception at 0x0, [...]: write access violation
-
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 -
@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
isnullptr
, hence the exception you get. -
@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?