Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Why the program crash after it call the function of DLL compiled by VC++
bluevoice last edited by
my main program is compiled by QT, and DLL is compiled by VC2005.
I has add a pushbutton on my dialog, then connect with the SLOT
and the detail of slot is
if(!lib.load() || !lib.isLoaded())
QMessageBox::warning(this, tr("Warn"),tr("Can't load AvScanerDrv.dll !"));
typedef int (*funGetCount)(void);
GetScanerCount = (funGetCount)lib.resolve("J_GetCount");
QMessageBox::warning(this,tr("Test"),tr("Test this demo"));
My DLL is simple, the J_GetScanerCount function is :
extern "C" int PASCAL EXPORT J_GetCount(HWND hParent)
//HWND hParent ;
but the main program would crash after it has displayed the messagebox about ("66","DLL")
[EDIT: code formatting, please wrap in @-tags, Volker]
Franzk last edited by
[quote author="bluevoice" date="1306985636"]my main program is compiled by QT, and DLL is compiled by VC2005.[/quote]No, your main program is not compiled by Qt. Qt is a library, not a compiler.
I don't know what your program is crashing on though.
cincirin last edited by
From what I see, your funGetCount is declared @typedef int (*funGetCount)(void)@, and exported function from dll is declared @int PASCAL EXPORT J_GetCount(HWND hParent)@ Try to export function from dll as: @int PASCAL EXPORT J_GetCount()@