Cannot compile z3 library in Visual Studio 2008

229 Views Asked by At

I would like to use the z3 4.4 managed API in a winforms application currently built with VS2008 (.net framework 3.5). I can use z3 in with .net 4.x applications without issues, but upgrading the current application to use .net 4.x is not currently feasible for reasons unrelated to z3. I am able to build the api and include Microsoft.z3.dll in my application. However, when compiling the z3 C++ library from the VS2008 command prompt, I get numerous errors where an attempt is made to implicitly convert a const_iterator to an iterator. Example:

duality_solver.cpp ..\src\duality\duality_solver.cpp(243) : error C2440: 'initializing' : cannot convert from 'std::_Tree<_Traits>::const_iterator' to 'std::_Tree<_Traits>::iterator' with [ _Traits=std::_Tset_traits,std::allocator,false> ] No constructor could take the source type, or constructor overload resolution was ambiguous

Changing std::_Tree<_Traits>::iterator to std::_Tree<_Traits>::const_iterator eliminates those errors. However, the resulting z3lib.dll copied to the bin\x86 directory of VS2008 project invariably produces the run-time error:

Unable to load DLL 'libz3.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

This also occurs if the libz3.dll is in the same directory as the api dll (Microsoft.z3.dll). I have also ensured that z3 and my project are built for same platform (x86). Using libz3.dll built with VS2013 produces the same run-time error above in the VS2008 project. Can z3 version 4.4.0 be used in a Visual Studio 2008 project? If so, how can I ensure that libz3.dll can be loaded to avoid the error above?

1

There are 1 best solutions below

3
On BEST ANSWER

We don't build and test on VS 2008, and furthermore will at some point move to C++ language features that are not supported on old platforms (but supported across operating systems and newer compilers).

On one of my machines, I use a community (free) version of VS2013 to build Z3.