_FP Macros in the LCK Different Between MS C and WATCOM C

ID: Q111990

2.00 2.50 | 2.50

MS-DOS    | WINDOWS
kbinterop kb3rdparty kbprg

The information in this article applies to:

SUMMARY

Calling the C macros to return a far pointer offset or a far pointer segment can give you different results in WATCOM C and Microsoft C.

MORE INFORMATION

The C macros _FP_OFF and _FP_SEG (in Microsoft C) or FP_OFF and FP_SEG (in WATCOM C) as their names imply are meant to deal with far pointers. You can, however, pass a near pointer to them and get different results depending upon which C compiler you use.

If you pass a near pointer in a Microsoft C compiled library, you will get garbage return values that could in turn cause a general protection (GP) fault if you were to call intdosx() from FoxPro for Windows.

However, WATCOM'S macros are able to handle the non-far pointer and thus return valid information that can be used by a call such as one to intdosx().

REFERENCES

Microsoft C/C++ "Run-Time Library Reference," version 7.0, page 293-294

Microsoft Visual C/C++ "Reference Volume III: Run-Time Library

  Reference," version 1.0, page 234

WATCOM C "Library," version 9.0, pages 195-196

WATCOM C "Library Reference," version 8.5, pages 188-189

Additional reference words: 2.00 2.50 lck far-pointer gpf KBCategory: kbinterop kb3rdparty kbprg KBSubcategory:

Last Reviewed: October 10, 1997