Annotation of os2sdk/demos/examples/dynlink/dynlib2.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * dynlib2.c
        !             3:  *
        !             4:  *   Created 17 August 1987 by Kevin Ruddell, Microsoft Corp
        !             5:  *
        !             6:  * Dynamic link library demo module with shared data.
        !             7:  *
        !             8:  */
        !             9: 
        !            10: #include <doscalls.h>
        !            11: #include "dynlib.h"        /* calling conventions                           */
        !            12: 
        !            13: unsigned count=0;          /* shared process count                          */
        !            14: 
        !            15: int far pascal             /* This routine is called by the initialization  */
        !            16: initroutine()              /* asm module to actually do the per-process     */
        !            17:                            /* initialization.                               */
        !            18: {
        !            19:     static char beg[]="I am number ";
        !            20:     static char First[]="First time initialization.\n\r";
        !            21:     static char NotFirst[]="Not first time initialization.\n\r";
        !            22:     char c;
        !            23:     int Written=0;
        !            24: 
        !            25:     if (count++ == 0)
        !            26:     {
        !            27:        DOSWRITE(1, First, sizeof(First)-1, &Written);         /* first time */
        !            28:     }
        !            29:     else
        !            30:     {
        !            31:        DOSWRITE(1, NotFirst, sizeof(NotFirst)-1, &Written);   /* not first  */
        !            32:     }
        !            33:     DOSWRITE(1, beg, sizeof(beg)-1, &Written);     /* show new count        */
        !            34:     c = count + '0';
        !            35:     DOSWRITE(1, &c, sizeof(char), &Written);
        !            36:     DOSWRITE(1, ".\n\r", 3, &Written);
        !            37:     INIT_ID( (unsigned far *) &count);             /* store count as id     */
        !            38:                                                    /* and pointer to count  */
        !            39:     return(1);                                     /* indicate success      */
        !            40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.