I don't understand it. In my application I can Instance classes from the dll but I can't inherit classes of dll with the Q_OBJECT macro declared, because the application don't start.
I don't understand it. In my application I can Instance classes from the dll but I can't inherit classes of dll with the Q_OBJECT macro declared, because the application don't start.
This might be a case of static initialization order fiasco as Q_OBJECT adds a static variable to every class.
Hah! Jacek beat me to it. I shouldn't be so long-winded. :P
Hello,
I optimized my application and my dll. I get out static and globals, now I'm working only in one class so there's no secrets but I'm in the same problem Q_OBJECT macro give me problems. I atach aklibs.pro is the pro of library. Perhaps somebody can found if there's some error. Dr. Watson don't tells nothing, now I'm searching Dr Mingw. There isn't a Dr mingw in the default qt-4.2.2+mingw precompiled binaries (setup.exe).
You tell me to to debug versions of dll, can you tell me more details about to do it.
Thank you.
Are you sure all your classes are properly exported? If so splitting your app between a library and an executable shouldn't be a problem at all, even when dealing with Q_OBJECT or QApplication creation. I myself use such a design in Edyuk and everything works fine...
Current Qt projects : QCodeEdit, RotiDeCode
Hello,
I compiled my library as staticlib and the application don't have problems runs all rigth with Q_OBJECT defined, but what that's mean ? with static lib runs ok, this mean that all is exported all rigth. This problem tells me that precomipiled binaries 4.2.2 for windows are working in static ? I'm confused in some concepts, why not in dynamic ?
Honestly your project file does not help much, especially because it is only a subdir wrapper. What would be interesting is a minimum compilable example reproducing the bug you're facing.
Didn't you previously said that YOUR library had been compiled as dll (shared library)??? The notion of exporting symbols is something that is very specific because AFAIk it is required only under Window$ with SHARED libraries... Thus, a static version compiling/linking/running fine does not imply that a shared one will do the same under Window$... Exporting/importing under Qt is done through two macros Q_DECL_EXPORT and Q_DECL_IMPORT which are often wrapped by another macro for more ease of use :I compiled my library as staticlib and the application don't have problems
Qt Code:
#ifdef _BUILD_MY_LIB_ #if defined(QT_DLL) || defined(QT_SHARED) #define MYLIB_EXPORT Q_DECL_EXPORT #endif #else #define MYLIB_EXPORT Q_DECL_IMPORT #endifTo copy to clipboard, switch view to plain text mode
Then definitions of classes/functions to export should be prefixed with th MYLIB_EXPORT macro (or whatever you called it of course) as follows :
Qt Code:
class MYLIB_EXPORT SomeClass {}; MYLIB_EXPORT void someFunction();To copy to clipboard, switch view to plain text mode
Hope this helps.![]()
Current Qt projects : QCodeEdit, RotiDeCode
fpujol (16th April 2007)
Bookmarks