After you create a DLL, you can use it in an application. The following figure shows a C source file, USEPUTS.C, that uses the myPuts function contained in the DLL MYPUTS.DLL.

    #include <os2.h>

    VOID EXPENTRY myPuts(PSZ);

    VOID main(VOID)
    {
        myPuts("Testing, 1,2,3");
    }

The module-definition file for USEPUTS.C tells OS/2 where to find the myPuts function. This module-definition file (USEPUTS.DEF) contains the information shown in the following figure.

    NAME useputs
    IMPORTS
        myputs.myPuts

The module-definition file tells OS/2 that USEPUTS imports the myPuts function from MYPUTS.DLL. USEPUTS.C is compiled and linked as shown below.

    icc  /C+ useputs.c

    link386 /noi useputs, , nul, , useputs


[Back] [Next]