Re: [Interest] Is it possible to override dll in runtime in Qt?
i think it should work using pluginloader something like below: QObject* getPrmt(QString path) { QDir pluginsDir(path) QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); return loader.instance(); } and call getPrmt function with any of A/Prmt.dll, B/Prmt.dll? On Wed, Apr 9, 2014 at 10:34 AM, Vincent Cai w...@cypress.com wrote: Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? Regards, Vincent. This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
-Original Message- From: interest-bounces+kai.koehne=digia@qt-project.org [mailto:interest-bounces+kai.koehne=digia@qt-project.org] On Behalf Of Vincent Cai Sent: Wednesday, April 09, 2014 7:04 AM To: interest@qt-project.org Subject: [Interest] Is it possible to override dll in runtime in Qt? Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? Which exact dll is loaded isn't something Qt can really influence. Check out http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx for the full details on Windows :) If you're loading Prmt.dll as a hard dependency of Core.dll there's nothing you can do in the programming logic itself, and you've to set up things from the outside (e.g. by changing a PATH environment variable in a launch.bat file , or something similar). If you're loading Prmt.dll dynamically at runtime (like a plugin), you can set an absolute path in your code. Regards Kai ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
Hi manish, Thanks for the reply. I am totally new to QPlugin and QLibrary. I don't quite understand your meaning. With your method below, can I load A/Prmt.dll then unload A/Prmt.dll and then load B/Prmt.dll in runtime without restarting Application? BTW, Core.dll is dependent on Prmt.dll, how can Core.dll know access symbols in Prmt.dll after changing Prmt.dll? Regards, Vincent. From: manish sharma [mailto:83.man...@gmail.com] Sent: Wednesday, April 09, 2014 2:42 PM To: Vincent Cai Cc: interest@qt-project.org Subject: Re: [Interest] Is it possible to override dll in runtime in Qt? i think it should work using pluginloader something like below: QObject* getPrmt(QString path) { QDir pluginsDir(path) QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); return loader.instance(); } and call getPrmt function with any of A/Prmt.dll, B/Prmt.dll? On Wed, Apr 9, 2014 at 10:34 AM, Vincent Cai w...@cypress.commailto:w...@cypress.com wrote: Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? Regards, Vincent. This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.orgmailto:Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
I think you might have to design your application something like below: For instance all the Prmt.dlls should implement a common interface for instance: PrmtInterface and place it under PrmtInterface.h And your Core.dll only know about PrmtInterface.h, it should not link to any of the Prmt.dll. And then you go on implementing Prmt.dlls and place it to different folders. And at run time you should use QPluginLoader to load/unload appropriate plugin. Hope this help! On Wed, Apr 9, 2014 at 12:22 PM, Vincent Cai w...@cypress.com wrote: Hi manish, Thanks for the reply. I am totally new to QPlugin and QLibrary. I don't quite understand your meaning. With your method below, can I load A/Prmt.dll then unload A/Prmt.dll and then load B/Prmt.dll in runtime without restarting Application? BTW, Core.dll is dependent on Prmt.dll, how can Core.dll know access symbols in Prmt.dll after changing Prmt.dll? Regards, Vincent. *From:* manish sharma [mailto:83.man...@gmail.com] *Sent:* Wednesday, April 09, 2014 2:42 PM *To:* Vincent Cai *Cc:* interest@qt-project.org *Subject:* Re: [Interest] Is it possible to override dll in runtime in Qt? i think it should work using pluginloader something like below: QObject* getPrmt(QString path) { QDir pluginsDir(path) QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); return loader.instance(); } and call getPrmt function with any of A/Prmt.dll, B/Prmt.dll? On Wed, Apr 9, 2014 at 10:34 AM, Vincent Cai w...@cypress.com wrote: Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? Regards, Vincent. This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
you might want to take a look at http://qt-project.org/doc/qt-5/qtwidgets-tools-plugandpaint-example.html On Wed, Apr 9, 2014 at 3:29 PM, manish sharma 83.man...@gmail.com wrote: I think you might have to design your application something like below: For instance all the Prmt.dlls should implement a common interface for instance: PrmtInterface and place it under PrmtInterface.h And your Core.dll only know about PrmtInterface.h, it should not link to any of the Prmt.dll. And then you go on implementing Prmt.dlls and place it to different folders. And at run time you should use QPluginLoader to load/unload appropriate plugin. Hope this help! On Wed, Apr 9, 2014 at 12:22 PM, Vincent Cai w...@cypress.com wrote: Hi manish, Thanks for the reply. I am totally new to QPlugin and QLibrary. I don't quite understand your meaning. With your method below, can I load A/Prmt.dll then unload A/Prmt.dll and then load B/Prmt.dll in runtime without restarting Application? BTW, Core.dll is dependent on Prmt.dll, how can Core.dll know access symbols in Prmt.dll after changing Prmt.dll? Regards, Vincent. *From:* manish sharma [mailto:83.man...@gmail.com] *Sent:* Wednesday, April 09, 2014 2:42 PM *To:* Vincent Cai *Cc:* interest@qt-project.org *Subject:* Re: [Interest] Is it possible to override dll in runtime in Qt? i think it should work using pluginloader something like below: QObject* getPrmt(QString path) { QDir pluginsDir(path) QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); return loader.instance(); } and call getPrmt function with any of A/Prmt.dll, B/Prmt.dll? On Wed, Apr 9, 2014 at 10:34 AM, Vincent Cai w...@cypress.com wrote: Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? Regards, Vincent. This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
Thanks a lot! I have already implemented Core.dll and Prmt.dll in the way you suggested. Will learn how to use QPluginLoder for such case. If anyone can provide a sample code, that would be greatly helpful. :) From: manish sharma [mailto:83.man...@gmail.com] Sent: Wednesday, April 09, 2014 6:06 PM To: Vincent Cai Cc: interest@qt-project.org Subject: Re: [Interest] Is it possible to override dll in runtime in Qt? you might want to take a look at http://qt-project.org/doc/qt-5/qtwidgets-tools-plugandpaint-example.html On Wed, Apr 9, 2014 at 3:29 PM, manish sharma 83.man...@gmail.commailto:83.man...@gmail.com wrote: I think you might have to design your application something like below: For instance all the Prmt.dlls should implement a common interface for instance: PrmtInterface and place it under PrmtInterface.h And your Core.dll only know about PrmtInterface.h, it should not link to any of the Prmt.dll. And then you go on implementing Prmt.dlls and place it to different folders. And at run time you should use QPluginLoader to load/unload appropriate plugin. Hope this help! On Wed, Apr 9, 2014 at 12:22 PM, Vincent Cai w...@cypress.commailto:w...@cypress.com wrote: Hi manish, Thanks for the reply. I am totally new to QPlugin and QLibrary. I don't quite understand your meaning. With your method below, can I load A/Prmt.dll then unload A/Prmt.dll and then load B/Prmt.dll in runtime without restarting Application? BTW, Core.dll is dependent on Prmt.dll, how can Core.dll know access symbols in Prmt.dll after changing Prmt.dll? Regards, Vincent. From: manish sharma [mailto:83.man...@gmail.commailto:83.man...@gmail.com] Sent: Wednesday, April 09, 2014 2:42 PM To: Vincent Cai Cc: interest@qt-project.orgmailto:interest@qt-project.org Subject: Re: [Interest] Is it possible to override dll in runtime in Qt? i think it should work using pluginloader something like below: QObject* getPrmt(QString path) { QDir pluginsDir(path) QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); return loader.instance(); } and call getPrmt function with any of A/Prmt.dll, B/Prmt.dll? On Wed, Apr 9, 2014 at 10:34 AM, Vincent Cai w...@cypress.commailto:w...@cypress.com wrote: Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? Regards, Vincent. This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.orgmailto:Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
Em qua 09 abr 2014, às 05:04:27, Vincent Cai escreveu: Dear All, I have an Qt application, which uses 2 dll, one is Prmt.dll and the other is Core.dll. Core.dll is dependent on Prmt.dll. Prmt.dll has multiple instances in different folders, for example: A/Prmt.dll, B/Prmt.dll... The Qt application provides an option to choose Prmt.dll, so it need to override Prmt.dll in runtime. Is it possible to override dll in runtime in Qt? LoadLibrary the DLL that you want before you load any DLLs that depend on it. And cross your fingers. We're talking about Windows. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Is it possible to override dll in runtime in Qt?
Em qua 09 abr 2014, às 06:52:01, Vincent Cai escreveu: With your method below, can I load A/Prmt.dll then unload A/Prmt.dll and then load B/Prmt.dll in runtime without restarting Application? Not a good idea. Unloading plugins is not recommended. Simply restart the application if you need to change plugins. Also, QPluginLoader needs to load something that is a Qt plugin. A generic DLL does not qualify. You'd need to use QLibrary directly or, better yet, Win32 LoadLibrary. BTW, Core.dll is dependent on Prmt.dll, how can Core.dll know access symbols in Prmt.dll after changing Prmt.dll? You have to unload Core.dll too. Hence, please use LoadLibrary for both DLLs and unload them both when you're done. And cross your fingers. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest