Unable to load qodbc driver not loaded
Hi All,
We are trying to create a DLL in C++(VS2005) using some of the Qt4.3.3 functionality(QtCore and QtSql). When i try to access this DLL from other C++ projects, its giving an error saying “Unable to load qodbc”.
In Normal Qt application , we can use addLibrayPath to add the plugins related to database and image, but how can we do this in a DLL project.
Thanks & Regards,
durgesh
4 replies
This is a core problem when you use Qt in dlls and use those dlls from non qt binaries. Some Qt functions require a Q(Core)Application instance.
You could load a plug-in “by hand”. It’s a bit tricky…
- if(lib.load())
- {
- if(0 != pInstanceFct)
- {
- qRegisterStaticPluginInstanceFunction(pInstanceFct);
- bLoaded = true;
- }
- }
it should work with most plug-ins :-) They just have to be found by the path.
@Gerolf, Since i am using Qt4.3.3, i can’t find some of the keywords like “qRegisterStaticPluginInstanceFunction” etc in my version.
i just used the following in the dll function
QLibrary lib(QLatin1String(“C:\\Qt\\4.3.3\\plugins\\sqldrivers\\qsqlodbcd4.dll”)); if(lib.load()) { lib.resolve(“qt_plugin_instance”); } else { MessageBoxA(NULL,“Unable to load qodbc”,“Error”,1); exit(-5); }
Now since i am not getting any MessageBox, i assume that i was able to load the plugin library. But again i am using this dll in another C++ console application, i am getting the error QODBC Driver not loaded.
You must log in to post a reply. Not a member yet? Register here!


