#Is Cygwin not a Windows platform rather than a Unix variant?
1 messages · Page 1 of 1 (latest)
It's complicated. People writing software usually only recognize a handful of platforms, usually 1. macOS, 2. Linux with GCC and Glibc and 3. Win32 with a specific version of Visual Studio. In reality, there are many other platforms that are similar in some regards and different in others.
Cygwin is a platform which:
- uses the LP64 integer model (like Linux)
- uses PE executables and dynamic libraries (like Windows)
- uses Newlib as its C runtime (which is rare)
- complies with a big portion of POSIX (Linux complies more, Win32 complies significantly less)
etc.
I use cygwin to build my C++ source code. cygwin don't call its Newlib, why?
What do you mean it doesn't "call its Newlib"?
cygwin is a special variant of newlib i guess (newlib-cygwin repo contains both newlib and cygwin code, and for cygwin it also builds the unix emulation layer under the winsup subdirectory which is not used on other platforms (like linux)
I use cygwin to build my C++ source code. cygwin don't call its Newlib, right?
so my guess is u can't use newlib in windows programs without cygwin. since cygwin is a C standard library implementation, it took newlib as base for its development (probably for avoiding duplicated efforts, a standard library is a lot of things, it makes sense to reuse some code
cygwin's documentation says its using newlib as c library, also if you check the source code of cygwin, you will find its in the same repo with newlib. LT;DR: i think Cygwin = Newlib + Unix emulation layer, so cygwin is not just newlib, so that is probably why it doesn't claim itself Newlib
or maybe you can say cygwin is a port of newlib to windows (but included within the official newlib source?), and then they rebranded the name to Cygwin. but most of the time when people talking about cygwin i think they are talking about the cygwin distribution (cygwin1.dll with all other unix utility goodies), instead of just the library.
because if you use newlib on windows, its name is called cygwin
right. its called cygwin when being used on windows
I still don't understand the question. Are you asking just about the name, as User_Yurri is assuming, or about API or ABI calls, or about something different?
Can I build my C++ source code without Newlib?
I'm not sure. I think C++ code doesn't normally use the C runtime.
c++ has nothing to do with newlib. newlib is a c runtime lib. and c++ wants c++ standard library. however in c++ you are allowed to use c code as well, so the answer is depending on whether or not your code uses unix exclusive features.
even it does, you are always free to use other unix layers on windows, for example midipix gives you musl libc, there were also something called PW32 which was a discontinued cygwin alternative
C++ standard library needs C library features, no?
Like malloc to implement new, or some other features
yeah... but not necessarily newlib i mean
Okay
@prime latch please do not use short word. where are you from?
sorry. i think you can easily to make gpt translate them for you. i'm not a native english speaker.
Hmm. libc++ website says "Only glibc-2.24 and later and no other libc is officially supported" on Linux. The manual for libstdc++ mentions malloc() quite a lot.
I'm starting to believe that C++ code actually relies on the C runtime.
Before I read C++ father books, he recommand we do not use malloc directly.
if windows can use glibc, it will save me much time.
i guess he wanted say the c++ standard library sometimes internally uses malloc/free as backend for implementing things like the new and delete operators.
It can't
I need to read more C++ standard library code.
New is going to call malloc
If he's saying "don't use malloc in C++" then it's not that unreasonable
But I don't agree with the advice "use new" either
sadly glibc on native windows won't make a lot of sense unless microsoft allow it (by providing enough unix-like interfaces). unlikely to happen since microsoft want to let you use win32 api instead and stuck on windows forever
if your asking "can i use cygwin to compile C/C++ code that does not depend on cygwin" then no you cant
this is very interesting
people are just slowly rebuilding autoconf's ./configure logic slowly up again, lmao
Most of that logic is useless
I can definitely appreciate that building new stuff from ground up will often just end up rediscovering old problems and old solutions to them, but not everything. For example if CMake and Ninja don't want to support "dead" platforms with non-conforming headers, tools and libraries, they can avoid a bunch of Autotools's complexity.