|
|
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: extern unsigned far id; /* non-shared id */ ! 14: unsigned count=0; /* shared process count, first-time switch */ ! 15: ! 16: int far pascal /* This routine is called by the initialization */ ! 17: initroutine() /* asm module to actually do the per-process */ ! 18: /* initialization. */ ! 19: { ! 20: static char beg[]="I am number "; ! 21: static char First[]="First time initialization.\n\r"; ! 22: static char NotFirst[]="Not first time initialization.\n\r"; ! 23: char c; ! 24: int Written=0; ! 25: ! 26: if (count++ == 0) ! 27: { ! 28: DOSWRITE(1, First, sizeof(First)-1, &Written); /* first time */ ! 29: } ! 30: else ! 31: { ! 32: DOSWRITE(1, NotFirst, sizeof(NotFirst)-1, &Written); /* not first */ ! 33: } ! 34: DOSWRITE(1, beg, sizeof(beg)-1, &Written); ! 35: c = count + '0'; /* show new count */ ! 36: DOSWRITE(1, &c, sizeof(char), &Written); ! 37: DOSWRITE(1, ".\n\r", 3, &Written); ! 38: id = count; /* store new non-shared id */ ! 39: return(1); /* indicates success */ ! 40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.