[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Few files are missing for socket programming on Windo
Re: [Tinycc-devel] Few files are missing for socket programming on Windows
Mon, 8 Apr 2019 19:50:51 +0200
When you do socket programming on unix, you have to include ~10 different
headers that provide all function and constant declarations (socket, bind,
select, ntohl ...) needed by BSD socket programming. Exact includes list
depends on unix system (solaris, BSD, Linux, macOS, AIX, HP UX ...)
On Windows, this set is different. Basically, winsock2.h provides them all (but
using internally qos.h and ws2ipdef.h by transitive closure).
A Windows programmer, as I do, just uses:
So a "portable code" looks like
// assume unix like ask ./configure which ones exist on specific system....
... // And others
I'm reluctant to edit those 3 Windows headers as using them ROOTB make socket
programming work on Windows. I may grab newer versions from future
My goal to let tcc user download tcc standard distrib and make their "portable"
code working whether they are on Windows or on Linux.
Those wanting to do GUI or Windows specific code, will need to download the
Hope it's more clear. Waiting from grischka input...
From: Michael Matz [mailto:address@hidden
Sent: Monday, April 08, 2019 19:24
To: address@hidden; address@hidden
Subject: Re: [Tinycc-devel] Few files are missing for socket programming on
On Sun, 7 Apr 2019, Christian Jullien wrote:
> Programming with sockets on Windows require:
> - qos.h
> - winsock2.h
> - ws2ipdef.h
Are qos.h and ws2ipdef.h really headers normally included by user code
or are they included in winsock2.h for some arcane features? (I have no
idea about Windows socket programming, so genuine question). If the
latter you might do like grischka and comment out some more arcane
includes of winsock2.h and then would only need to add this one header and
the .def file.
> - ws2_32.def
> Which are missing from standard tinycc git repository (under win32).
> Ok I've grabbed .h from winapi-full-for-0.9.27 and "./tcc -impdef
> $(WINDIR)/System32/ws2_32.dll -o lib/ws2_32.def" produced missing .def
> Question, do you allow me to add those files in win32 repository subdir?
> - socket is an important part of software programming
> - socket is not Windows specific and can be used to make programs compatible
> between linux and Windows
So the winsock2.h API is roughly equivalent to the POSIX socket API?
Otherwise this argument is less convincing.
> - ws2_32.def is missing from winapi-full-for-0.9.27
> - winapi-full-for-0.9.27 is BIG as it contains almost all Windows API, so it
> only useful for those doing Windows specific programming and they'll probably
> use them all.
> Is it OK for those 4 additional files?
I think it's reasonable to add (but as said above, maybe you can make it
two files only), but we do need to be careful about feature-creep;
winapi-full exists for a reason, so we should continue to have tinycc only
provide basic headers from the target system. (I would personally go even
further and remove even the windows specific headers that we have, but I
do realize that that might be a bit harsh to users that simply want to
checkout tinycc and see it working).
I would like to know what grischka has to say to this, though, so give it
a couple days before you include them.
> Btw, I also modified my https://sourceforge.net/projects/wintcc/ which
> makes standalone and reproducible tcc 32/64 Windows executables
> bootstrapped with Cygwin. So I'm personally not lost with socket on