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

1.1     ! root        1: /*
        !             2:  * dynlib.c
        !             3:  *
        !             4:  *   Created 17 August 1987 by Kevin Ruddell, Microsoft Corp
        !             5:  *
        !             6:  * Dynamic link library demo module with non-shared data.
        !             7:  *
        !             8:  */
        !             9: 
        !            10: /*
        !            11:  * NB - The variable _acrtused must be declared in one of the modules of the
        !            12:  *     dll.  The C compiler generates this symbol as an extern to ensure
        !            13:  *     that the runtime library startup module crt0 will be pulled in by the
        !            14:  *     linker.  Declaring _acrtused will keep this unwanted code out.
        !            15:  *
        !            16:  * NB - To be made part of the named data segment, variables at the external
        !            17:  *     level must be declared static or they must be initialized or both.
        !            18:  */
        !            19: 
        !            20: #include <doscalls.h>
        !            21: 
        !            22: int _acrtused=0;
        !            23: extern unsigned far count;  /* shared count                                 */
        !            24: unsigned id=0;             /* process-unique identifier                     */
        !            25: 
        !            26: void far pascal            /* This routine is called by the process to show */
        !            27: printdata()                /* on the screen the current values of the       */
        !            28:                            /* non-shared id and the shared count.           */
        !            29: {
        !            30:     static char beg[]="I am number ";
        !            31:     static char mid[]=".  There are ";
        !            32:     static char end[]=" processes attached.\r";
        !            33:     char c;
        !            34:     int Written;
        !            35: 
        !            36:     DOSWRITE(1, beg, sizeof(beg)-1, &Written);
        !            37:     c = id + '0';
        !            38:     DOSWRITE(1, &c, sizeof(char), &Written);
        !            39:     DOSWRITE(1, mid, sizeof(mid)-1, &Written);
        !            40:     c = count + '0';
        !            41:     DOSWRITE(1, &c, sizeof(char), &Written);
        !            42:     DOSWRITE(1, end, sizeof(end)-1, &Written);
        !            43: }

unix.superglobalmegacorp.com

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