[Qt-interest] QSqlDatabase::database() within DLL (Qt4 on win32 and mingw)

Adolf Markus Berthold berthold at organet.com
Tue Mar 3 10:56:51 CET 2009


Hello all !

A Database-Connection that was created with:

QSqlDatabase::addDatabase("QOCI","hallo")

can be perfectly accessed throughout the application by using the
object returned by:

QSqlDatabase::database("hallo")

But what about code inside a DLL ?
If I call QSqlDatabase::connectionNames() from within a DLL-function,
it always returns an empty list and QSqlDatabase::database()
always returns an invalid database. Now I believe that it is simply
impossible to use the qt-connection-name-mechanism inside a DLL
because a DLL runs in some kind of separated memory region and can
not access the application's global object that QSqlDatabase::addDatabase()
used to store the resulting object.

Can anybody approve or disprove this ?


BTW: Under Linux, the above construct works nicely, even using a
shared object (*.so).


-- 

Mit freundlichen Grüssen

Adolf Berthold

===========================================
OrgaNet Gesellschaft für EDV-basierte
Informations- und Kommunikationssysteme mbH
Bonner Strasse 31
50389 Wesseling

Tel.: +49 2236 94335 13
Fax.: +49 2236 94335 23
Mail: berthold at organet.com
Http://www.organet.com

Registergericht: Amtsgericht Köln, HR B 44230
Geschäftsführer: Stefan Lang, Randolf Rautenberg
===========================================





More information about the Qt-interest-old mailing list