Page 1 of 1

MSVC build broken

Posted: 2020-07-02 12:40
by gvanem
Hello forum.

I'm trying to build FileZilla using MSVC-2019 (with .DLLs) and see that many class-functions
and data-members have __declspec(dllimport) in the wrong place.
E.g. in lib/libfilezilla/string.hpp after pre-processing:

Code: Select all

native_string __declspec(dllimport) to_native(std::string_view const& in);
This is not the same as:

Code: Select all

__declspec(dllimport) native_string to_native(std::string_view const& in);
MinGW and clang-cl seems to accept both. But it causes several link-failures with MSVC.

Re: MSVC build broken

Posted: 2020-07-02 13:16
by botg
What is the exact error message you are getting?

Re: MSVC build broken

Posted: 2020-07-03 10:33
by gvanem
botg wrote:
2020-07-02 13:16
What is the exact error message you are getting?
When linking FileZilla.exe with the import-library of libfilezilla-7.dll, I get several
errors like these:

Code: Select all

 error LNK2005: "public: __thiscall fz::buffer::buffer(void)" (??0buffer@fz@@QAE@XZ) already defined in FZengine.lib(controlsocket.obj)
 

Re: MSVC build broken

Posted: 2020-07-05 09:28
by gvanem
Anyway, I gave up on trying to build using -DFZ_USING_DLL.
I managed to get a working FileZilla with MSVC-x86. But clang-cl (my favourite compiler at the moment)
have many issues with event-macros like EVT_LIST_COL_CLICK().

A single file needed patching to work for x86. Namely libfilezilla/lib/util.cpp.
The diff for it is here: https://gist.github.com/gvanem/f96c20a1 ... 42c0d337b9

Re: MSVC build broken

Posted: 2020-07-07 08:01
by botg
"FZengine.lib" That's not a file built by the provided workspace files.