The funny thing about both Cygwin and WSL is that, in my experience, many of the people who make use of them wish that they didn't have to make use of them. For me, Cygwin makes it a little easier for me to forget I'm not where I want to be (especially with things like winpty and apt-cyg). In Cygwin I can run URxvt just like at home, and run all the nonsense legacy software I need to for work, just like it were actually reasonable. In WSL, I can do none of that. It just doesn't work. I have a few co-workers who run WSL alongside cmd.exe. If I'm going to have to do that, I'd rather just stick to Cygwin.
I forked Cygwin's main DLL (cygwin1.dll) to create "Cygnal": an drop-in alternative that provides more Windows-like behaviors in various areas. Programs built under Cygwin can be bundled with Cygnal. Then (for instance) they have path handling that is familiar to Windows users.
If you need your math to be correct, use Cygwin.
Access to Win32 APIs.
Static link and distribute to any windows user.
Better interoperability with Windows/cmd/powershell
I should rebase Cygnal to Cygwin 3.0.
As someone who has mostly used the MSVC environment on Windows, can you comment on how often Cygwin allows for a Linux port to compile and run with no source changes? I read a while back that the fork "emulation" is a performance hit. I wonder if Cygwin benefited from the WSL fork implementation [0]
Programs that fork and immediately exec can be improved under Cygwin by using the spawn, family of system calls, like what I have here:
http://www.kylheku.com/cgit/txr/tree/stream.c
in this source file there is a version of the run function that uses _wspawnvp, support for which is detected in my ./configure script. Well, _wspawnlp, but they're in the same family:
printf "Checking for _wspawnlp ... "
cat > conftest.c <<!
#include "config.h"
#include <process.h>
#include <wchar.h>
int main(int argc, char **argv)
{
wchar_t *wargv[] = { L"foo", L"bar", 0 };
int r = _wspawnlp(_P_WAIT, L"foo", wargv);
return 0;
}
!
if conftest ; then
printf "yes\n"
printf "#define HAVE_WSPAWN 1\n" >> config.h
else
printf "no\n"
fi
The porting experience of Unix and Linux programs to Cygwin is pretty darn good. You can tell just from the large number of packages that are available under Cygwin.Even programs that use termios to put the TTY in raw mode and use ANSI escape sequences to control the screen work in Cygwin. Cygwin's I/O system contains a layer that translates ANSI codes to Win32 Console API calls. This works inside the Windows CMD.EXE console, not only the Cygwin terminall.
fork has its own implementation, cygwin is entirely unrelated to WSL (as before the Interix subsystem). It's extremely slow though. WSL or mingw are much faster. But mingw is a pain.
> This feature requires Windows 10 1803 or later and WSL installed!
Interesting, so is cygwin going to be based on WSL?
https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-sys...
Remember putting all the usr binaries (cat,ls,sed,etc.) in the windows path and it was great!