|
|
1.1 root 1: /*
2: * dynlib2.c
3: *
1.1.1.2 ! root 4: * Created by Microsoft Corp. 1987
1.1 root 5: *
6: * Dynamic link library demo module with shared data.
7: *
8: */
9:
1.1.1.2 ! root 10: #define INCL_DOSFILEMGR
! 11:
! 12: #include <os2def.h>
! 13: #include <bsedos.h>
1.1 root 14: #include "dynlib.h" /* calling conventions */
15:
16: unsigned count=0; /* shared process count */
17:
1.1.1.2 ! root 18: int APIENTRY /* This routine is called by the initialization */
1.1 root 19: initroutine() /* asm module to actually do the per-process */
20: /* initialization. */
21: {
22: static char beg[]="I am number ";
23: static char First[]="First time initialization.\n\r";
24: static char NotFirst[]="Not first time initialization.\n\r";
25: char c;
1.1.1.2 ! root 26: USHORT Written=0;
1.1 root 27:
28: if (count++ == 0)
29: {
1.1.1.2 ! root 30: DosWrite(1, First, sizeof(First)-1, &Written); /* first time */
1.1 root 31: }
32: else
33: {
1.1.1.2 ! root 34: DosWrite(1, NotFirst, sizeof(NotFirst)-1, &Written); /* not first */
1.1 root 35: }
1.1.1.2 ! root 36: DosWrite(1, beg, sizeof(beg)-1, &Written); /* show new count */
1.1 root 37: c = count + '0';
1.1.1.2 ! root 38: DosWrite(1, &c, sizeof(char), &Written);
! 39: DosWrite(1, ".\n\r", 3, &Written);
1.1 root 40: INIT_ID( (unsigned far *) &count); /* store count as id */
41: /* and pointer to count */
42: return(1); /* indicate success */
43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.