winsup/doc/faq-api.xml, -programming.xml: change Win32 to Windows/API
This commit is contained in:
parent
6329d546dd
commit
ed97836149
@ -18,7 +18,7 @@ Windows into the C library. Then your apps should (ideally) run on POSIX
|
|||||||
systems (Unix/Linux) and Windows with no changes at the source level.
|
systems (Unix/Linux) and Windows with no changes at the source level.
|
||||||
</para>
|
</para>
|
||||||
<para>The C library is in a DLL, which makes basic applications quite small.
|
<para>The C library is in a DLL, which makes basic applications quite small.
|
||||||
And it allows relatively easy upgrades to the Win32/POSIX translation
|
And it allows relatively easy upgrades to the Windows/POSIX translation
|
||||||
layer, providing that DLL changes stay backward-compatible.
|
layer, providing that DLL changes stay backward-compatible.
|
||||||
</para>
|
</para>
|
||||||
<para>For a good overview of Cygwin, you may want to read the Cygwin
|
<para>For a good overview of Cygwin, you may want to read the Cygwin
|
||||||
@ -140,7 +140,7 @@ spawn family of calls if possible.
|
|||||||
<para>Here's how it works:
|
<para>Here's how it works:
|
||||||
</para>
|
</para>
|
||||||
<para>Parent initializes a space in the Cygwin process table for child.
|
<para>Parent initializes a space in the Cygwin process table for child.
|
||||||
Parent creates child suspended using Win32 CreateProcess call, giving
|
Parent creates child suspended using Windows CreateProcess call, giving
|
||||||
the same path it was invoked with itself. Parent calls setjmp to save
|
the same path it was invoked with itself. Parent calls setjmp to save
|
||||||
its own context and then sets a pointer to this in the Cygwin shared
|
its own context and then sets a pointer to this in the Cygwin shared
|
||||||
memory area (shared among all Cygwin tasks). Parent fills in the child's
|
memory area (shared among all Cygwin tasks). Parent fills in the child's
|
||||||
@ -326,7 +326,7 @@ name under the API.
|
|||||||
<para>E.g., the POSIX select system call can wait on a standard file handles
|
<para>E.g., the POSIX select system call can wait on a standard file handles
|
||||||
and handles to sockets. The select call in Winsock can only wait on
|
and handles to sockets. The select call in Winsock can only wait on
|
||||||
sockets. Because of this, the Cygwin dll does a lot of nasty stuff behind
|
sockets. Because of this, the Cygwin dll does a lot of nasty stuff behind
|
||||||
the scenes, trying to persuade various Winsock/Win32 functions to do what
|
the scenes, trying to persuade various Winsock/Windows functions to do what
|
||||||
a Unix select would do.
|
a Unix select would do.
|
||||||
</para>
|
</para>
|
||||||
<para>If you are porting an application which already uses Winsock, then
|
<para>If you are porting an application which already uses Winsock, then
|
||||||
@ -337,11 +337,11 @@ direct calls to Winsock functions. If you use Cygwin, use the POSIX API.
|
|||||||
</answer></qandaentry>
|
</answer></qandaentry>
|
||||||
|
|
||||||
<qandaentry id="faq.api.winsock">
|
<qandaentry id="faq.api.winsock">
|
||||||
<question><para>I don't want Unix sockets, how do I use normal Win32 winsock?</para></question>
|
<question><para>I don't want Unix sockets, how do I use normal Windows winsock?</para></question>
|
||||||
<answer>
|
<answer>
|
||||||
|
|
||||||
<para>You don't. Look for the Mingw-w64 project to port applications using
|
<para>You don't. Look for the Mingw-w64 project to port applications using
|
||||||
native Win32/Winsock functions. Cross compilers packages to build Mingw-w64
|
native Windows API/Winsock functions. Cross compilers packages to build Mingw-w64
|
||||||
targets are available in the Cygwin distro.
|
targets are available in the Cygwin distro.
|
||||||
</para>
|
</para>
|
||||||
</answer></qandaentry>
|
</answer></qandaentry>
|
||||||
|
@ -76,7 +76,7 @@ sizeof(void*) 4 8 8
|
|||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
<para>This difference can result in interesting problems, especially when
|
<para>This difference can result in interesting problems, especially when
|
||||||
using Win32 functions, especially when using pointers to Windows
|
using Windows API functions using pointers to Windows
|
||||||
datatypes like LONG, ULONG, DWORD. Given that Windows is LLP64, all of
|
datatypes like LONG, ULONG, DWORD. Given that Windows is LLP64, all of
|
||||||
the aforementioned types are 4 byte in size, on 32 as well as on 64 bit
|
the aforementioned types are 4 byte in size, on 32 as well as on 64 bit
|
||||||
Windows, while `long' on 64 bit Cygwin is 8 bytes.</para>
|
Windows, while `long' on 64 bit Cygwin is 8 bytes.</para>
|
||||||
@ -189,10 +189,10 @@ string pointer given to printf is missing the upper 4 bytes.
|
|||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
<emphasis>Don't</emphasis> use C base types together with Win32 functions.
|
<emphasis>Don't</emphasis> use C base types together with Windows API functions.
|
||||||
Keep in mind that DWORD, LONG, ULONG are <emphasis>not</emphasis> the same
|
Keep in mind that DWORD, LONG, ULONG are <emphasis>not</emphasis> the same
|
||||||
as long and unsigned long. Try to use only Win32 datatypes in conjunction
|
as long and unsigned long. Try to use only Windows datatypes in conjunction
|
||||||
with Win32 API function calls to avoid type problems. See the above
|
with Windows API function calls to avoid type problems. See the above
|
||||||
ReadFile example. Windows functions in printf calls should be treated
|
ReadFile example. Windows functions in printf calls should be treated
|
||||||
carefully as well. This code is common for 32 bit code, but probably prints
|
carefully as well. This code is common for 32 bit code, but probably prints
|
||||||
the wrong value on 64 bit:
|
the wrong value on 64 bit:
|
||||||
@ -438,11 +438,11 @@ gcj --main=Hello Hello.java
|
|||||||
</answer></qandaentry>
|
</answer></qandaentry>
|
||||||
|
|
||||||
<qandaentry id="faq.programming.win32-api">
|
<qandaentry id="faq.programming.win32-api">
|
||||||
<question><para>How do I use Win32 API calls?</para></question>
|
<question><para>How do I use Windows API calls?</para></question>
|
||||||
<answer>
|
<answer>
|
||||||
|
|
||||||
<para>Cygwin tools require that you explicitly link the import libraries
|
<para>Cygwin tools require that you explicitly link the import libraries
|
||||||
for whatever Win32 API functions that you are going to use, with the exception
|
for whatever Windows API functions that you are going to use, with the exception
|
||||||
of kernel32, which is linked automatically (because the startup and/or
|
of kernel32, which is linked automatically (because the startup and/or
|
||||||
built-in code uses it).
|
built-in code uses it).
|
||||||
</para>
|
</para>
|
||||||
@ -464,7 +464,7 @@ including user32, gdi32 and comdlg32.
|
|||||||
or at least after all the object files and static libraries that reference them.
|
or at least after all the object files and static libraries that reference them.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<note><para>There are a few restrictions for calls to the Win32 API.
|
<note><para>There are a few restrictions for calls to the Windows API.
|
||||||
For details, see the User's Guide section
|
For details, see the User's Guide section
|
||||||
<ulink url="https://cygwin.com/cygwin-ug-net/setup-env.html#setup-env-win32">Restricted Win32 environment</ulink>,
|
<ulink url="https://cygwin.com/cygwin-ug-net/setup-env.html#setup-env-win32">Restricted Win32 environment</ulink>,
|
||||||
as well as the User's Guide section
|
as well as the User's Guide section
|
||||||
@ -472,7 +472,7 @@ as well as the User's Guide section
|
|||||||
</answer></qandaentry>
|
</answer></qandaentry>
|
||||||
|
|
||||||
<qandaentry id="faq.programming.win32-no-cygwin">
|
<qandaentry id="faq.programming.win32-no-cygwin">
|
||||||
<question><para>How do I compile a Win32 executable that doesn't use Cygwin?</para></question>
|
<question><para>How do I compile a Windows executable that doesn't use Cygwin?</para></question>
|
||||||
<answer>
|
<answer>
|
||||||
|
|
||||||
<para>The compilers provided by the <literal>mingw64-i686-gcc</literal> and
|
<para>The compilers provided by the <literal>mingw64-i686-gcc</literal> and
|
||||||
@ -528,7 +528,7 @@ lines must start with tabs. This is not specific to Cygwin.
|
|||||||
</answer></qandaentry>
|
</answer></qandaentry>
|
||||||
|
|
||||||
<qandaentry id="faq.programming.win32-headers">
|
<qandaentry id="faq.programming.win32-headers">
|
||||||
<question><para>Why can't we redistribute Microsoft's Win32 headers?</para></question>
|
<question><para>Why can't we redistribute Microsoft's Windows API headers?</para></question>
|
||||||
<answer>
|
<answer>
|
||||||
|
|
||||||
<para>Subsection 2.d.f of the `Microsoft Open Tools License agreement' looks
|
<para>Subsection 2.d.f of the `Microsoft Open Tools License agreement' looks
|
||||||
@ -536,7 +536,7 @@ like it says that one may not "permit further redistribution of the
|
|||||||
Redistributables to their end users". We take this to mean that we can
|
Redistributables to their end users". We take this to mean that we can
|
||||||
give them to you, but you can't give them to anyone else, which is
|
give them to you, but you can't give them to anyone else, which is
|
||||||
something that we can't agree to. Fortunately, we
|
something that we can't agree to. Fortunately, we
|
||||||
have our own Win32 headers which are pretty complete.
|
have our own Windows API headers which are pretty complete.
|
||||||
</para>
|
</para>
|
||||||
</answer></qandaentry>
|
</answer></qandaentry>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user