Export enum classes
-
Hey, I need to export some enum classes from my dll's on windows. They look like this:
namespace application::book_operation_status { Q_NAMESPACE enum class BookOperationStatus { Success, ... }; Q_ENUM_NS(BookOperationStatus) } // namespace application::book_operation_status
I have defined a symbol "APPLICATION_LIBRARY" for the export (following the Qt documentation), but just adding it here:
enum class APPLICATION_LIBRARY BookOperationStatus
Gives me an error on this line:
Q_ENUM_NS(BookOperationStatus)
What is the proper way to export Q-enum classes?
-
Hi,
I think, you need to use Q_NAMESPACE_EXPORT).
-
Hi,
I think, you need to use Q_NAMESPACE_EXPORT).
@SGaist Thanks, this is exactly what I was looking for!
Aside of that, do you know if there is any mechanism to automatically export all symbols from my dlls? It is quite annoying to put the macros described here: https://doc.qt.io/qt-6/sharedlibrary.html everywhere.
-
-
I currently don't however it's rather a good thing to only export what you are currently using rather than just everything "just in case".
-
I currently don't however it's rather a good thing to only export what you are currently using rather than just everything "just in case".
@SGaist Well, since my application is split into multiple layers which are shared libraries, its not that useful to export everything manually. It is also not really that nice to add all that export stuff to more than 1000 symbols during the linux->windows port haha.
I know that cmake has this: https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html for exporting all symbols, but it doesnt work with Qt
-
@SGaist Well, since my application is split into multiple layers which are shared libraries, its not that useful to export everything manually. It is also not really that nice to add all that export stuff to more than 1000 symbols during the linux->windows port haha.
I know that cmake has this: https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html for exporting all symbols, but it doesnt work with Qt
@Creaperdown are you using cmake for your project ?
-
@Creaperdown are you using cmake for your project ?
@SGaist yes, cmake and Qt 6.5
-
@Creaperdown are you using cmake for your project ?
@SGaist Is there a way to export all symbols (including the Qt stuff) via cmake?
-
@Creaperdown are you using cmake for your project ?
@SGaist I have tried
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
again but it does not seem to work for qt symbols. I get errors mentioning the static meta object