It's M$ idea. When you write DLLs, you have to explicitly mark objects (functions, classes or variables) that should be visible from the outside and you do this with __declspec(dllexport) tag. All other objects won't be accessible from the outside and only DLL code will be able to use them.
Using GCC and other Unix compilers you can do the same with linker scripts (or __attribute__ tag), so you don't need funny macros.
Because an object has to be exported when you compile the library and imported when you use the library. That's why you need a macro that is once Q_DECL_EXPORT and once Q_DECL_IMPORT.
Bookmarks