dparrish / libcli

Libcli provides a shared library for including a Cisco-like command-line interface into other software. It's a telnet interface which supports command-line editing, history, authentication and callbacks for a user-definable function tree.
https://dparrish.com/link/libcli
GNU Lesser General Public License v2.1
289 stars 143 forks source link

Visual Studio support #61

Open BenjiHansell opened 3 years ago

BenjiHansell commented 3 years ago

Please can someone clarify to me the state of Visual Studio support?

It seems that this library doesn't build out of the box with VS2019. There are many issues, the most blatant being the unguarded #include <unistd.h>. However, there's an awful lot of #ifndef WIN32 in the source code, as if at some point, some version of this library worked with some version of Visual Studio.

RobSanders commented 3 years ago

I personally do not use Visual Studio, and also have not tried to build on Windows as my target platform is Linux. David may be able to offer more insight as the original developer. On my current Linux box (CentOS 7) /usr/include/unistd.h has an internal include guard already in it.

BenjiHansell commented 3 years ago

Thanks @RobSanders

To clarify, in my original post where I referred to "the unguarded #include <unistd.h>", I just meant that I would expect to see that include excluded from MSVC builds, e.g.:

#ifndef WIN32
#include <unistd.h>
#endif
RobSanders commented 3 years ago

Ah, understand now. I did a quick check in some older versions (1.9.5, 1.9.6, 1.9.7)and it looks like the include for unistd.h has not been inside a WIN32 guard check for several years. Not saying it shouldn't be, but as mentioned, I've never built this for Windows.

dparrish commented 3 years ago

I am also a Linux-only builder, so I can't be of much help to you there. There were previously users on the win32 platform that added the guards. They said it worked on win32, and it still worked on Linux so I merged the patches.

I'd still be happy to merge further patches for it to compile on modern Windows if you want to fix it?

On Thu, Nov 19, 2020 at 3:02 AM Rob Sanders notifications@github.com wrote:

Ah, understand now. I did a quick check in some older versions (1.9.5, 1.9.6, 1.9.7)and it looks like the include for unistd.h has not been inside a WIN32 guard check for several years. Not saying it shouldn't be, but as mentioned, I've never built this for Windows.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dparrish/libcli/issues/61#issuecomment-729777549, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPIQZMOYNR2MAMAGBBN5TSQPVY7ANCNFSM4T2CDO3A .

BenjiHansell commented 3 years ago

@dparrish thanks for your explanation. So far, my attempts to patch the latest release for Windows haven't got me far. If I do succeed, I'll be sure to contribute it back. Thank you for your time.