Hi
What is the use of using MACRO in between the class name and class keyword such as the following declaration.
Qt Code:
{ ... }To copy to clipboard, switch view to plain text mode
Hi
What is the use of using MACRO in between the class name and class keyword such as the following declaration.
Qt Code:
{ ... }To copy to clipboard, switch view to plain text mode
it's used for correct compilation of dll on windows.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
babu198649 (4th February 2009)
Thanks,
Is it legal to define macro between the class keyword and class name or it is compiler specific.
Does defining macro between class name and class keyword makes any difference on the linux.
Does anyone knows a good link which explains about this(googling had not helped).
actually import/export specifiers are used only on windows on Linux they have no effect.
take a look at QTDIR/src/corelib/global/qglobal.h where you can find Q_DECL_EXPORT/Q_DECL_IMPORT macros
so, if you need to create your own dll you need to specify these macros, see detailes here dll & QtQt Code:
#ifndef Q_DECL_EXPORT # ifdef Q_OS_WIN # define Q_DECL_EXPORT __declspec(dllexport) # elif defined(QT_VISIBILITY_AVAILABLE) # define Q_DECL_EXPORT __attribute__((visibility("default"))) # endif # ifndef Q_DECL_EXPORT # define Q_DECL_EXPORT # endif #endif #ifndef Q_DECL_IMPORT # if defined(Q_OS_WIN) # define Q_DECL_IMPORT __declspec(dllimport) # else # define Q_DECL_IMPORT # endif #endifTo copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Thanks again,
As per the c++ language standard can a macro be present between class-name and class keyword or it is an extension of the compiler.
Hi, you should be able to place a macro nearly everywhere as it will just be replaced by the preprocessor.
Some of the replacements are compiler specific (e.g. __declspec), some define calling conventions like the order of parameters on the stack for a function call.
Ginsengelf
Last edited by Ginsengelf; 4th February 2009 at 13:15. Reason: updated contents
babu198649 (4th February 2009)
Right,Unless the macro doesnot contains any valueyou should be able to place a macro nearly everywhere as it will just be replaced by the preprocessor
Thanks ,That cleared my doubt.Some of the replacements are compiler specific (e.g. __declspec)
Bookmarks