Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Static qt question
ahura_24 last edited by
i have one question. doest exist macro that tell me my qt library is static or dynamic ?
tnx so much
butterface last edited by
Such a macro cannot exist. Macros will be evaluated during the preprocessor step. It is not interesting for the preprocessor what happens later on. Also the compiler is not interested in that. The first one is the linker but then it is too late for macros.
What for do you need the information. If it is statically linked your application itself will take care of using the already loaded functions. If dynamically linked the application is still in charge but is asks the OS where to search for the dll's/so's. If they are not there it won't work of course.
This sort of thing is usually handled by a define passed to a compiler in the build system. I don't think Qt has something out of the box, but you can add it yourself.
hskoglund last edited by
Well if you only need it for Windows, you could check for the presence of Qt's DLLs:
bool bStaticBuild = (!::GetModuleHandle(L"Qt5Core")) && (!::GetModuleHandle(L"Qt5Cored"));