[Qt-interest] using an application's databse connection inside a DLL (on win32)

Rick Vernam rickv at hobi.com
Thu Mar 5 19:27:37 CET 2009


On Thursday 05 March 2009 12:17:29 pm Adolf Markus Berthold wrote:
> Hi all !
>
> I asked about this before but got no answer. Since this is rather
> important for me, I kindly ask again.
>
> Is it possible for a function inside a DLL on win32 to access and use a
> database connection, that was created in the main application, through the
> QSqlDatabase::database() function ? And if this is not possible, can this
> DLL-function access this connection if I pass on the corresponding
> QSqlDatabase object as parameter ?
I don't know about the first question, but as for this second one - yes.  make 
sure to link the .dll against Qt's sql libraries (ie, QT += sql in the .pro 
file...if you have one), and also to include the proper qt database headers in 
DLL .h or .cpp files.
you might want to pass by reference, or pass a pointer or something...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090305/c497083e/attachment.html 


More information about the Qt-interest-old mailing list