nemerle / dcc

This is a heavily updated version of the old DOS executable decompiler DCC
GNU General Public License v2.0
146 stars 27 forks source link

VS compile fixes #16

Closed lab313ru closed 8 years ago

lab313ru commented 8 years ago

Should fix all compilation errors in Visual Studio.

nemerle commented 8 years ago

'and' 'not' 'or' are standard keywords that are not supported by MSVC in default mode. instead of replacing them, you could use the compatibility header Microsoft added to 'fix' the problem.

#ifdef _MSC_VER
#include <iso646.h>
#endif
lab313ru commented 8 years ago

Anyway mixing 'not' and '!', 'and' and '&&' is not a good practice. So, instead of adding such headers, which may not be available in some vs versions, let it be more correct.

nemerle commented 8 years ago

Ok, the issue with 'and', 'or' 'not' keywords should be patched up now. And those keywords should be used consistently throughout the codebase.

lab313ru commented 8 years ago

There are things, that still does not compatible with Visual Studio. Could you merge some more fixes from my request?

nemerle commented 8 years ago

I think we could consider removing LLVM as a dependency for now, it makes compiling things troublesome on windows, and no interesting LLVM features are used in the codebase anyway :)

lab313ru commented 8 years ago

Good idea. And then, we'll try to fix rest of errors.

nemerle commented 8 years ago

The latest commit (58532f4) should make dcc llvm-free

lab313ru commented 8 years ago

Allmost good! But, problem with std::min/max still exists. And Boost (by dcc_original project) requires linking with (there is no path to this library in cmake). libboost_regex-vc140-mt-sgd-1_60.lib

nemerle commented 8 years ago

The last commit should have fixed the std::min/max problem. As for boost, we don't use boost_regex in the project ?

lab313ru commented 8 years ago

I thought no. But VS requires it. I don't know why. I even not found any requirement for this file anywhere.

nemerle commented 8 years ago

hmm... we use header-only boost libraries, I have no idea why your compilation would try to use regex ? Maybe some kind of boost configuration issue ?

lab313ru commented 8 years ago

Maybe. I think I have to rebuild it.

nemerle commented 8 years ago

Nope, I've managed to replicate this... investigating

nemerle commented 8 years ago

Found the problem, fix soon

nemerle commented 8 years ago

Ok, fixes are commited. The dcc builds on msvc2015

lab313ru commented 8 years ago

And, last things:

nemerle commented 8 years ago

Well setting /W4 in the CMakeLists.txt is done to encourage fixing those warnings ;)

And static linkage.. that's another issue - why would we do that ?

Will close this PR, since the msvc2015 build 'works' now ?

lab313ru commented 8 years ago

Yep, it works now.

lab313ru commented 8 years ago

Ups, sorry.

for(uint32_t v : prog.relocTable) { // <- iterator is not dereferensable in DccFrontend.cpp
lab313ru commented 8 years ago

I had not only compiling fixes, but launching fixes too.

nemerle commented 8 years ago

That range-based for loop should be working. I have no idea yet why msvc barfs on this code.

lab313ru commented 8 years ago

But it happens. Could you rewrite it as classic iterator loop?

nemerle commented 8 years ago

Found the actual bug, fix is in the latest commit

lab313ru commented 8 years ago

Ok. Looks like old bugs are fixed now.