INF: How to Resolve External Calls to the OS/2 API

ID Number: Q34372

5.10 6.00 6.00a

OS/2

Summary:

In Microsoft C versions 5.1, 6.0, and 6.0a for OS/2, the header file

OS2.H supplies function prototypes for the OS/2 application program

interface (API) and definitions of the types, structures, and

constants that will be needed by the API.

The prototypes declare the functions as far procedures with the

Pascal/FORTRAN calling convention. If the functions are not correctly

prototyped, the linker will search for functions with a C calling

convention. Because the naming convention is different for C and

Pascal/FORTRAN functions, the linker won't be able to find the API and

will issue the error:

L2029: 'symbol': unresolved external

More Information:

When you include OS2.H, only the most common types, structures, and

constants are defined. This is done to minimize compile time. The

other definitions are divided into groups that are defined only if the

appropriate constants are defined before the #include <os2.h>. The

following is a summary of some of the more common constants and which

subset of the API they define:

#define INCL_DOS /* Kernel system definitions */

#define INCL_DOSERRORS /* Error constants */

#define INCL_KBD /* Keyboard definitions */

#define INCL_MOU /* Mouse definitions */

#define INCL_VIO /* Video-display definitions */

#define INCL_SUB /* INCL_KBD + INCL_MOU + INCL_VIO */

#define INCL_BASE /* INCL_DOS + INCL_DOSERRORS + INCL_SUB */

This information is documented in the README.DOC file that comes with

Microsoft C version 5.1 and Chapter 14 of "Microsoft C Advanced

Programming Techniques," comes with C 6.0 and 6.0a.

Additional reference words: 5.10 6.00 6.00a