20.4.1 Creating a Prototype for the Library Function

A prototype statement should be used to define each library function in each application source file. The prototype statement for the sample function is as follows:

VOID FAR PASCAL MinRoutine (int, LPSTR);

The purpose of a prototype statement is to define a function's parameters and return value to the compiler. The compiler is then able to create the proper code for the library function. In addition, the compiler is able to issue warning messages when a function's prototype differs from its usage and when the /W2 compiler option has been selected. It is strongly recommended that you create prototypes for application functions as well, to minimize the problems that can occur from errors of this type. For example, a warning message would be generated if MinRoutine, as defined previously, were used with the wrong number of parameters, as in the following example:

MinRoutine (5);

Calling the Library Function

The call to a dynamic-link library function is indistinguishable from a call to a static-link library function, or to other functions in the application itself. Once you have made the proper prototype definition, the exported functions can be called by using normal C syntax.