MATES / Modular Automatic Test Equipment System API  2.5.0.0
mates_test_02.c
#include <stdio.h>
#include <windows.h>
#include "mates.h"
typedef int (*_mates_open)(char *, int);
typedef int (*_mates_close)(int);
int main(void)
{
unsigned int i;
unsigned int mem;
int h;
_mates_open mopen;
_mates_close mclose;
for (i = 0; i < 10; i++)
{
HMODULE hdll = LoadLibrary("mates.dll");
if (hdll == 0)
{
printf("Cannot load dll\n");
return (-1);
}
mopen = (_mates_open)GetProcAddress(hdll, "mates_open");
mclose = (_mates_close)GetProcAddress(hdll, "mates_close");
if (mopen == 0 || mclose == 0)
{
printf("Cannot get functions\n");
return (-1);
}
h = mopen("./../tests/proxy.mon", 1);
if (h == 0)
{
printf("Cannot open MATES\n");
return (-1);
}
mclose(h);
printf("Iteration %u\n", i);
FreeLibrary(hdll);
}
}