INF: Unresolved Externals w/ OS/2 Functions and INCL_NOCOMMON

ID Number: Q45946

5.10 6.00 6.00a

OS/2

Summary:

In Microsoft C versions 5.1, 6.0, and 6.0a for OS/2, if you are using

OS/2 functions and getting "unresolved external" messages at link time

even though OS2.H is included, check for a definition of the manifest

constant INCL_NOCOMMON. The definition of this constant excludes any

function group that is not explicitly included by the definition of

another manifest constant.

For example, to include the OS/2 system functions (DOS) and exclude

all others, the following two statements must exist in the source

code:

#define INCL_NOCOMMON

#define INCL_DOS

Look closely at the "unresolved external" message. If the compiler has

prepended an underscore to the function name, then the prototype is

not being included. All OS/2 functions are defined with a Pascal

calling sequence. Therefore, there should never be an underscore

prepended to the function name.

As a quick test, remove the INCL_NOCOMMON statement from the code and

recompile. If the program compiles and links without the INCL_NOCOMMON

statement, then you have only to determine which manifest constant

correctly includes the function group that includes the function in

question.

As an alternative, compiling at warning level three generates a "no

prototype given" warning for the function if the function prototype is

being excluded by the INCL_NOCOMMON statement. If this is the case,

determine which manifest constant will include the function prototype,

and define it along with the INCL_NOCOMMON statement.

A comprehensive listing of these manifest constants can be found in

the "Microsoft Operating System/2 Programmer's Reference Volume 1,"

pages 41-44.

Additional reference words: 5.10 6.00 6.00a