Creating a Prototype for the Library Function

A prototype statement should be used to define each DLL routine in each
application source file. The prototype statement for our sample DLL routine is
as follows:

VOID FAR PASCAL MinRoutine (int, LPSTR);

The purpose of a prototype statement is to define a routine's parameters and return value to the compiler. The compiler is then able to create the proper code for the library routine. In addition, the compiler is able to issue warning messages when a routine's prototype differs from its usage and when the /W2 compiler option has been selected. It is strongly recommended that prototypes be created for application routines 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 to be used with the wrong number of parameters, as shown next:

MinRoutine (5);

Calling the Library Function

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