/* TESTDLL.C */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

extern int far cdecl r286printf(char far *mask, ...);

#define DLL_EXPORT  far pascal _export _loadds

static int mine = 0;

int DLL_EXPORT foo(int x)
{
    r286printf("foo(%u) called\n", x);
    mine = x;
    return x*x;
}

int DLL_EXPORT get(void)
{
    r286printf("get() called\n");
    // use Borland register pseudovariables:
    r286printf("in DLL: DS=%04x SS=%04x\n", _DS, _SS);
    return mine;
}

int DLL_EXPORT length(char far *s)
{
    return strlen(s);   // try out run-time library in DLL
}
