I installed PostgreSQL, then downloaded and installed libpq64. Afterwards, I downloaded the Qt 4.6.2 source code and compiled it successfully with Visual Studio 2008. After providing the path to the libs in libpq64, I compiled the QPSQL sucessfully too.
My sql plugin folder contains the following files:
V:\windows\x64\QT-4.6.2_VC9.0_Bin\plugins\sqldrivers>dir *.dll
Datenträger in Laufwerk V: ist Data
Verzeichnis von V:\windows\x64\QT-4.6.2_VC9.0_Bin\plugins\sqldrivers
qsqlite4.dll
qsqlited4.dll
qsqlpsql4.dll
qsqlpsqld4.dll
V:\windows\x64\QT-4.6.2_VC9.0_Bin\plugins\sqldrivers>dir *.dll
Datenträger in Laufwerk V: ist Data
Verzeichnis von V:\windows\x64\QT-4.6.2_VC9.0_Bin\plugins\sqldrivers
qsqlite4.dll
qsqlited4.dll
qsqlpsql4.dll
qsqlpsqld4.dll
To copy to clipboard, switch view to plain text mode
I use a simple test program:
main(int argc , char* argv[])
{
std
::cout <<
"QSqlDatabase::drivers() output: " <<
QSqlDatabase::drivers().
join(QString("; ")).
toLatin1().
data() <<
"\n";
//output of all loaded sql plugins
return 0;
}
main(int argc , char* argv[])
{
QApplication app(argc,argv); // load plugins
std::cout << "QSqlDatabase::drivers() output: " << QSqlDatabase::drivers().join(QString("; ")).toLatin1().data() << "\n"; //
output of all loaded sql plugins
return 0;
}
To copy to clipboard, switch view to plain text mode
The output in Release Mode:
QSqlDatabase::drivers(): QSQLITE; QPSQL7; QPSQL
The output in Debug Mode:
QSqlDatabase::drivers(): QSQLITE
As you can see, the QPSQL plugin is not loaded in debug mode.
I debugged into the qt code, the problem is in
qlibrary_win.cpp Line 70:
pHnd
= LoadLibrary
((wchar_t*)QDir::toNativeSeparators(attempt
).
utf16());
pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16());
To copy to clipboard, switch view to plain text mode
returns 0x00000000 for qsqlpsqld4.dll
My PATH variable contains
PATH=V:\windows\x64\QT-4.6.2_VC9.0_Bin\bin;V:\windows\x64\libpq64;"V:\toolkits\windows\x64\PostgreSQL\bin";[...]
PATH=V:\windows\x64\QT-4.6.2_VC9.0_Bin\bin;V:\windows\x64\libpq64;"V:\toolkits\windows\x64\PostgreSQL\bin";[...]
To copy to clipboard, switch view to plain text mode
These paths contain the following DLLs:
libeay32.dll
libpq.dll
ssleay32.dll
comerr32.dll
gssapi32.dll
iconv.dll
k5sprt32.dll
krb5_32.dll
libeay32.dll
libiconv-2.dll
libintl-8.dll
libpq.dll
libxml2.dll
libxslt.dll
msvcr71.dll
ssleay32.dll
zlib1.dll
libeay32.dll
libpq.dll
ssleay32.dll
comerr32.dll
gssapi32.dll
iconv.dll
k5sprt32.dll
krb5_32.dll
libeay32.dll
libiconv-2.dll
libintl-8.dll
libpq.dll
libxml2.dll
libxslt.dll
msvcr71.dll
ssleay32.dll
zlib1.dll
To copy to clipboard, switch view to plain text mode
What am I missing? How can I use the QPSQL plugin in debug mode?
Thank you for your help.
Bookmarks