The particular need on this is because of the current situation
with determining the background functionality for the
gettimeofday. DllMain allows to initialize stuff before the DLL
can be actually used. Thus, we use different time API on win7
and win8 and later, so the function pointer needs to be
initialized before anything in the DLL could even demand it.
The change also opens the door for the further optimizations,
as now we're able to do the very basic initializations for the
whole DLL before it could ever start to live. Fe on this way the
TLS initialization could be done, when utilizing the
DLL_THREAD_ATTACH/DETACH case. Whether it's really usable in
portable way should be synced with other platforms.
Be aware that it's dangerous as it possibly causes dead locks.
So to use with care. One willing to add items to DllMain should
better read the documentation twice and even then try to defer
the necessary action.
- Added some typeof checks to handle JS errors introduced in VS2014
- Added VS2014 to the list of compilers
- Changed to use stdint.h if we are using VS2014 or higher
- Skip defining timespec if we're using VS2014 or higher
- Moved u_char typedef out to always be defined regardless of VS version
windows sockets. The winsock implementation will only work with sockets;
our implementation works with sockets and file descriptors.
By association, stream_select() will now operate correctly with files, pipes and sockets.
This change required linking against the winsock2 library. In terms of
compatibility, only older versions of windows 95 do not have winsock2
installed by default. It is available as a redistributable file, and is most likely installed by any OS patches (eg: Internet Explorer) applied by the user.
Also, add a win32 compatible pipe test when opening a stream from a pipe. This test will only work on NT, win2k and XP platforms. Without this test, interleaved fread() and select() calls would cause the read buffer to be clobbered. I will be working on a fix for this issue for win9x.
Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"
All identifiers that begin with an underscore and either an uppercase
letter or another underscore are always reserved for any use by the
implementation.