|
|
Microsoft OS/2 SDK 12-15-1987
/*
* dynlib2.c
*
* Created 17 August 1987 by Kevin Ruddell, Microsoft Corp
*
* Dynamic link library demo module with shared data.
*
*/
#include <doscalls.h>
#include "dynlib.h" /* calling conventions */
extern unsigned far id; /* non-shared id */
unsigned count=0; /* shared process count, first-time switch */
int far pascal /* This routine is called by the initialization */
initroutine() /* asm module to actually do the per-process */
/* initialization. */
{
static char beg[]="I am number ";
static char First[]="First time initialization.\n\r";
static char NotFirst[]="Not first time initialization.\n\r";
char c;
int Written=0;
if (count++ == 0)
{
DOSWRITE(1, First, sizeof(First)-1, &Written); /* first time */
}
else
{
DOSWRITE(1, NotFirst, sizeof(NotFirst)-1, &Written); /* not first */
}
DOSWRITE(1, beg, sizeof(beg)-1, &Written);
c = count + '0'; /* show new count */
DOSWRITE(1, &c, sizeof(char), &Written);
DOSWRITE(1, ".\n\r", 3, &Written);
id = count; /* store new non-shared id */
return(1); /* indicates success */
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.