Why the program crash after it call the function of DLL compiled by VC++
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]
[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.
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()@