| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | osmode |
Paul Edwards wrote in a message to All:
PE> /* Anyone know why this program gets a link error if
PE> compiled with Watcom C++ 10.0B for OS/2 */
PE>
PE> #include
PE> #include
PE> int main(void)
PE> {
PE> int x;
PE>
PE> x = _osmode;
PE> printf("x is %d\n", x);
PE> return (0);
PE> }
This has significance only in 16-bit programs and is set in the startup
code by a call to DosGetMachineMode(), which exists only in the 16-bit OS/2
API. Obviously, if your 32-bit OS/2 program is running, you are in
protected mode.
The only real purpose for _osmode is in bound programs written mostly to
the Family API. By checking _osmode, you can use certain features only
accessible in one mode or the other, or which have to be done differently
depending upon mode. For example, if you wanted a FAPI program to be
mouse-aware, you would need to check _osmode at run time and call either
the DOS Int 33h or OS/2 Mou subsystem, as appropriate.
If what you want to know is whether your code is going through the 16-bit
or 32-bit compiler at compile time, check for the "M_I86" or
"M_I386" predefined macro. If you want to know whether your code
is being compiled for DOS or OS/2, check for the "__DOS__" or
"__OS2__" predefined macros.
While "__DOS__" and "__OS2__" are Watcom-specific,
"M_I386" is used in IBM's OS2.H header, so any 32-bit OS/2
compiler can be counted upon to predefine it. If it is defined, OS2.H
defines "INCL_32" or otherwise defines "INCL_16", and
it is safe to use these once OS2.H has itself been included.
If you really are writing a FAPI program, you will see "M_I86"
and "__OS2__" defined. Watcom does not come with a complete set
of tools for FAPI, and you will have to get BIND.EXE and API.LIB from the
OS/2 1.3 Toolkit (on DevCon).
-- Mike
---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 955 SEEN-BY: 712/407 515 628 704 713/888 800/1 7877/2809 @PATH: 323/107 150 3615/50 105/103 42 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.