Use of wt version 3 and version 4 alongside!
Added by suzuki kikamora 21 days ago
I have a project that uses WT (Widgets Toolkit) for both the DBO (Database Object) and WT. I want to move all my DBO into one library and use the WT3 DBO in this library, while my main app will be in WT4 and will use this library. However, since my changes are significant, I can't move the entire project to WT4. Can I use WT3 and WT4 in a project alongside each other, or should they be separated into a library and an app?
Replies (2)
RE: Use of wt version 3 and version 4 alongside! - Added by Matthias Van Ceulebroeck 20 days ago
Hey Suzuki!
Wt and Wt::Dbo should be able to operate completely separately from each other. I think the best way around this is to ensure that when you build each library, the projects are named accordingly Wt3
and Wt4
.
In your CMake you can then find both packages find_package(wt3 REQUIRED COMPONENTS Dbo)
and find_package(wt4 REQUIRED COMPONENTS Wt)
. The target can then be told to use the specific entries target_link_libraries(yourproject PRIVATE Wt4::Wt Wt3::Dbo)
.
I have not verified this approach, but this ought to work, as far as I can tell. If it doesn't, you can update this, and I'll take a closer look.
Best,
Matthias
RE: Use of wt version 3 and version 4 alongside! - Added by suzuki kikamora 14 days ago
I built Wt version 3 and Wt version 4, changing the namespace from Wt to Wt3 in version 3 and updating the include file paths (the header files in the Wt directory for version 3 are now in the Wt3 directory)!
Everything builds and runs properly! However, when I include dbo from version 3 in my project, which is a Wt version 4 web application, I encounter a runtime exception related to the WString destructor.
I figured out that dbo and Widget use WString as a shared utility. When I include dbo from version 3 and use WDateTime to persist a time column in the database and retrieve the current date and time, I get an exception!
So, I need to change the header guards of WString and other shared utilities to be able to include dbo from version 3 and widgets from version 4 because I need to include WString(or other shared utils) from both version, am I right?
Additionally, I am using QMake(.pro), not CMake!