Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - certain data items are used by the watcom c/c++ run-time library and may be http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Certain data items are used by the Watcom C/C++ run-time library and may be
inspected (or changed in some cases) by a program.  The defined items are:

_amblksiz
    Prototype in <stdlib.h>.

    This unsigned int data item contains the increment by which the "break"
    pointer for memory allocation will be advanced when there is no freed
    block large enough to satisfy a request to allocate a block of memory.
     This value may be changed by a program at any time.

__argc
    Prototype in <stdlib.h>.

    This int item contains the number of arguments passed to  main.

__argv
    Prototype in <stdlib.h>.

    This char ** item contains a pointer to a vector containing the actual
    arguments passed to  main.

daylight
    Prototype in <time.h>.

    This unsigned int has a value of one when daylight saving time is
    supported in this locale and zero otherwise.  Whenever a time function
    is called, the  tzset function is called to set the value of the
    variable.  The value will be determined from the value of the TZ
    environment variable.

_doserrno
    Prototype in <stdlib.h>.

    This int item contains the actual error code returned when a DOS
    function fails.

environ
    Prototype in <stdlib.h>.

    This char ** __near data item is a pointer to an array of character
    pointers to the environment strings.

errno
    Prototype in <errno.h>.

    This int item contains the number of the last error that was detected.
     The run-time library never resets  errno to 0.  Symbolic names for
    these errors are found in the <errno.h> header file.  See the
    descriptions for the  perror and  strerror functions for information
    about the text which describes these errors.

fltused_
    The C compiler places a reference to the  fltused_ symbol into any
    module that uses a floating-point library routine or library routine
    that requires floating-point support (e.g., the use of a float or double
    as an argument to the  printf function).

_fmode
    Prototype in <stdlib.h>.

    This data item contains the default type of file (text or binary)
    translation for a file.  It will contain a value of either

    O_BINARY
        indicates that data is transmitted to and from streams unchanged.

    O_TEXT
        indicates that carriage return characters are added before linefeed
        characters on output operations and are removed on input operations
        when they precede linefeed characters.

    These values are defined in the <fcntl.h> header file.  The value of
     _fmode may be changed by a program to change the default behavior of
    the  open,  fopen,  creat and  sopen functions.  The default setting of
    _fmode is  O_TEXT, for text-mode translation.   O_BINARY is the setting
    for binary mode.  You can change the value of  _fmode in either of two
    ways:

     .  You can include the object file BINMODE.OBJ when linking your
        application.  This object file contains code to change the initial
        setting of  _fmode to  O_BINARY, causing all files except  stdin,
         stdout, and  stderr to be opened in binary mode.
     .  You can change the value of  _fmode directly by setting it in your
        program.


_MaxThreads
    There is a limit to the number of threads an application can create
    under 16-bit OS/2 and 32-bit NetWare.  The default limit is 32.  This
    limit can be adjusted by statically initializing the unsigned global
    variable __MaxThreads.

    Under 32-bit OS/2, there is no limit to the number of threads an
    application can create.  However, due to the way in which multiple
    threads are supported in the Watcom libraries, there is a small
    performance penalty once the number of threads exceeds the default limit
    of 32 (this number includes the initial thread).  If you are creating
    more than 32 threads and wish to avoid this performance penalty, you can
    redefine the threshold value of 32.  You can statically initialize the
    global variable __MaxThreads.

    By adding the following line to your multi-threaded application, the new
    threshold value will be set to 48.


         unsigned __MaxThreads = { 48 };


__minreal
    Prototype in <stdlib.h>.

    This data item contains the minimum amount of real memory (below 640K)
    to reserve when running a 32-bit DOS extended application.

_osmajor
    Prototype in <stdlib.h>.

    This unsigned char variable contains the major number for the version of
    DOS executing on the computer.  If the current version is 3.20, then the
    value will be 3.

_osminor
    Prototype in <stdlib.h>.

    This unsigned char variable contains the minor number for the version of
    DOS executing on the computer.  If the current version is 3.20, then the
    value will be 20.

_osbuild
    (Win32 only) Prototype in <stdlib.h>.

    This unsigned short variable contains the operating system build number
    for the version of Windows NT executing on the computer.

_osver
    (Win32 only) Prototype in <stdlib.h>.

    This unsigned int variable contains the operating system build number
    for the version of Windows NT executing on the computer.
    On Win32s or Windows 95 platforms, the high bit of the low-order 16-bit
    word is turned on.  Windows 95 does not have a build number.


         unsigned short dwBuild;

         // Get build numbers for Windows NT or Win32s

         if( _osver < 0x8000 )       // Windows NT
             dwBuild = _osver;
         else if (_winmajor < 4)     // Win32s
             dwBuild = _osver & 0x8000;
         else                        // Windows 95
             dwBuild =  0;           // No build numbers provided

    Note that the Win32  GetVersionEx function is the preferred method for
    obtaining operating system version number information.

_osmode
    (16-bit only) Prototype in <stdlib.h>.

    This unsigned char variable contains either the value DOS_MODE which
    indicates the program is running in real address mode, or it contains
    the value OS2_MODE which indicates the program is running in protected
    address mode.

_psp
    Prototype in <stdlib.h>.

    This data item contains the segment value for the DOS Program Segment
    Prefix.  Consult the technical documentation for your DOS system for the
    process information contained in the Program Segment Prefix.

_stacksize
    On 16-bit 80x86 systems, this unsigned int value contains the size of
    the stack for a TINY memory model program.  Changing the value of this
    item during the execution of a program will have no effect upon the
    program, since the value is used when the program starts execution.  To
    change the size of the stack to be 8K bytes, a statement such as follows
    can be included with the program.


         unsigned int _stacksize = { 8 * 1024 };


stdaux
    Prototype in <stdio.h>.

    This variable (with type FILE *) indicates the standard auxiliary port
    (not available in Windows NT).

stderr
    Prototype in <stdio.h>.

    This variable (with type FILE *) indicates the standard error stream
    (set to the console by default).

stdin
    Prototype in <stdio.h>.

    This variable (with type FILE *) indicates the standard input stream
    (set to the console by default).

stdout
    Prototype in <stdio.h>.

    This variable (with type FILE *) indicates the standard output stream
    (set to the console by default).

stdprn
    Prototype in <stdio.h>.

    This variable (with type FILE *) indicates the standard printer.  (not
    available in Windows NT).

sys_errlist
    Prototype in <stdlib.h>.

    This variable is an array of pointers to character strings for each
    error code defined in the <errno.h> header file.

sys_nerr
    Prototype in <stdlib.h>.

    This int variable contains the number of messages declared in
     sys_errlist.

_threadid
    Prototype in <stddef.h>.

    This variable/function may be used to obtain the id of the current
    thread which is an int.  In the 32-bit libraries,  _threadid is a
    function that returns a pointer to an int.  In the 16-bit libraries,
     _threadid is a far pointer to an int.  Note that the value stored where
     _threadid points does not necessarily change when a thread context
    switch occurs (so do not make a copy of the pointer ...  it may change).
     To obtain the current thread identifier, simply code:

         int tid = *_threadid;


timezone
    Prototype in <time.h>.

    This long int contains the number of seconds of time that the local time
    zone is earlier than Coordinated Universal Time (UTC) (formerly known as
    Greenwich Mean Time (GMT)).  Whenever a time function is called, the
     tzset function is called to set the value of the variable.  The value
    will be determined from the value of the TZ environment variable.

tzname
    Prototype in <time.h>.

    This array of two pointers to character strings indicates the name of
    the standard abbreviation for the time zone and the name of the
    abbreviation for the time zone when daylight saving time is in effect.
     Whenever a time function is called, the  tzset function is called to
    set the values in the array.  These values will be determined from the
    value of the TZ environment variable.

__wargc
    Prototype in <stdlib.h>.

    This int item contains the number of arguments passed to  wmain.

__wargv
    Prototype in <stdlib.h>.
    This wchar_t ** item contains a pointer to a vector containing the
    actual arguments passed to  wmain.

_wenviron
    Prototype in <stdlib.h>.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson