/* CTESTDLL.C */

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

#define DLL_EXPORT  far pascal _export _loadds

static int mine = 0;

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

int DLL_EXPORT get(void)
{
    printf("get() called\n");
    // use Borland register pseudovariables:
    printf("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
}


unsigned far pascal Start(void) /* autoinit entry point */
{
//    _CRT_DLLinit();
    return 1;                   /* okay to load DLL */
}
