Subject: Re: Patches for Windows, Wincng, Visual Studio

Re: Patches for Windows, Wincng, Visual Studio

From: Marc Hoersken <>
Date: Mon, 19 May 2014 19:29:35 +0200

On 19.05.2014 15:18, Bob Kast wrote:
> The patch: "0001-for-MS-VS-builds-specify-the-libraries-that-are-requ.patch
> " has nothing to do with whether VS project files are used or not. The point
> of this patch is to build into the library the instructions of what
> libraries need to be linked in. Putting this in the C source has several
> benefits:
> - if the user is building a static library, these instructions pass through
> to the project using the library. The idea is this: If a user is building an
> application XYZ and links in a static library of libssh2.lib, he will also
> need to specify to link in BCRYPT.lib and CRYPT32.lib. These are libraries
> that he is not using directly but are being used by libssh2 so it may be
> confusing. By including these statements, he needs to link only libssh2 and
> libssh2 will direct what it needs under the covers.
> - Windows project files typically have many configurations (release, debug,
> x64, x86, etc.). The libraries to include typically are needed for all
> configurations, and it is easy to have a configuration miss some parameter.
> This puts it in one place instead of 4 or more places.

Okay, I understand and see the benefits now. Thanks for the clarification.
Would you mind testing it using the following #ifdef condition instead
of yours?

#ifdef _MSC_VER

I like to be as explicit as possible regarding conditions for
compiler-specific directives.
If that works for you, I would be glad to go ahead and merge your patch
using that simplified, but hopefully more explicit condition.

> Because the export statements were there in libssh2, they were added
> as exports to my DLL. I don't feel a library should do that sort of thing in
> someone else's DLL.

Sounds reasonable to me. Thanks, merged and pushed with an updated
commit message based upon your clarification.

> I apologize for not adopting the correct style. I had thought I did. Can you
> give me an example of what I did wrong?

Sorry, I should have been more clear with regards to what I meant with
"code style".
From my personal perspective on the libssh2 source code, I think the
approach is to avoid complex constructs unless they are necessary.
Please see my comments regarding the three patches which in my opinion
require more feedback/information from my last email.

Best regards,
Received on 2014-05-19