// in Par.h Header:
typedef void (WINAPI *PORTOUT) (short int Port, char Data);
typedef char (WINAPI *PORTIN) (short int Port);
typedef short int (WINAPI *ISDRIVERINSTALLED)();
extern PORTOUT PortOut;
extern PORTIN PortIn;
extern ISDRIVERINSTALLED IsDriverInstalled;
// for loading dll
extern int LoadIODLL();
// in Par.cpp:
PORTOUT PortOut;
PORTIN PortIn;
ISDRIVERINSTALLED IsDriverInstalled;
HMODULE hio;
int LoadIODLL()
{
hio = LoadLibrary("CS"); // loads CS.dll
if (hio == NULL) return 1;
PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");
PortIn = (PORTIN)GetProcAddress(hio, "PortIn");
IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");
atexit(FreeLibrary(hio));
}